Jpardee

About me: Just A Developer That Loves Elgg! Had To Set Up A Profile And Give Back With Some Plugins! Thanks Elgg!
Location:
Email: service@illustratedweb.net

Send private message

You must be logged in to send a private message.

Group membership

Activity

  • Jpardee replied on the discussion topic delete user account
    ok i found everything and iv got it all set up, only one problem now, when i try to delete my test user it tells me im not authorize to perform this action, so......im sorry iv done lots of searching i cant find where to change it from a admin... view reply
  • Jpardee replied on the discussion topic delete user account
    still have not found the default admin link source code to delete a user, where is it? im sure if i can find the source code then i can code it myself, i have found the action file but not the source code for the button itself, anyone know where its... view reply
  • Jpardee joined the group General Discussion
  • Jpardee added a new discussion topic delete user account in the group General Discussion
    i really need the ability to let a user delete themselves, due to the nature of my site if a person does not want to be there anymore i need it to be an instant process done at the users convenience
    • ok i found everything and iv got it all set up, only one problem now, when i try to delete my test user it tells me im not authorize to perform this action, so......im sorry iv done lots of searching i cant find where to change it from a admin action to a user action......any ideas where that might be?

    • You'd have to unregister the action, then reregister it for authenticated users.  That's assuming the action file doesn't have admin_gatekeeper() in it, in which case you won't be able to do anything with it anyway.

      Honestly, you're better off using a new action.  The action you're trying to use can delete any arbitrary user if you're an admin.  Trying to hijack that action for anyone to use could lead to a security issue where a non admin could delete another account.  There are ways to avoid this using your method of hijacking that action, but that would require more work than just writing a new action.

      Read the action file to see how the user deletion is done, then implement that in your own action that doesn't require a guid to be passed, but gets the currently logged in user to delete.

    • if you've 'found everything... all set up... not authorize to perform this action...' -> you're doing something very wrongly in the wrong place - but it's kinda hard to say what's really happening without seeing your code - and without such details - the rest of us got no idea what you're coding and where @ ? ;-X

  • Jpardee added a new discussion topic restrict a plugin to a specific user guid in the group Plugin Development
    i need a little help..... im creating a 2nd blog plugin that will basicly be my news, i have one account on my site that controlls all the news and i want to restrict this 2nd blog plugin to that specific user guid iv been trying this and it kinda...
  • Jpardee added a new discussion topic dashboard/river ajax more posts in the group Feedback and Planning
    how can i make it so that when u look at the dashboard it shows say 20 items, add a button that says more posts and it will auto or ajax another 20 posts, once the river/dashboard has 40 posts on it the next option would be to go to another page...
  • Jpardee added a new discussion topic remove friends icon in topbar in the group Feedback and Planning
    how can i remove the friends icon in the topbar, i have it implied in my theme nice and the icon just makes things redundent
    • You need to hook into the register, menu:topbar hook and remove the item with the name "friends."

      Your callback would like something like this: https://gist.github.com/1888009

      FYI: I found this information by checking the HTML. All menus in Elgg have classes that let you guess the menu names. If you look at the menu item's <li> tag you'll see the class "elgg-menu-item-messages". Look up the DOM to the <ul> tag and you'll see the class "elgg-menu elgg-menu-topbar elgg-menu-topbar-default".

      These classes mean you're looking at the menu item named "friends" in the "default" section of the menu named "topbar".

    • Brett, wouldn't it be wonderful to have another hook before 'register' in the factory, which would allow to use register/unregister api, without having to iterate through the return array on 'register' to find the menu in question?

    • @Ismayil - I actually forgot about the unregister function. In this case you CAN use it because the friends menu item is registered by core. So you can replace the hook with elgg_unregister_menu_item('topbar', 'friends'). That's much simpler :)

  • Jpardee replied on the discussion topic Gifts Names In River
    get 500 internal server error when trying to send the gift no change in the wording at all still UserA has sent a GIFT to UserB code..... <?php/** * Elgg Gifts plugin * Send gifts to you friends * * @package Gifts *... view reply
  • Jpardee replied on the discussion topic Gifts Names In River
    im not a noob and i write code all day every day so im ready view reply
  • Jpardee replied on the discussion topic Gifts Names In River
     Gifts iionly, Galdrapiu, Christian Heckelmann 1.8.0beta1  \Public HTML\mod\gifts\views\default\river\object\gifts/create.php <?php/** * Elgg Gifts plugin * Send gifts to you friends * * @package... view reply
  • Jpardee added a new discussion topic Gifts Names In River in the group Elgg Technical Support
    im trying to get my river create.php to display basicly this right now it displays : USERA Has Sent A GIFT To USERB i want to to display  USERA Has Sent A (Gift's Name, Exmaple: Banana) To USERB now i found in my database...
    • get 500 internal server error when trying to send the gift

      no change in the wording at all still UserA has sent a GIFT to UserB

      code.....

      <?php
      /**
       * Elgg Gifts plugin
       * Send gifts to you friends
       *
       * @package Gifts
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Christian Heckelmann
       * @copyright Christian Heckelmann
       * @link http://www.heckelmann.info
       */

      // only logged in users
      gatekeeper();
      action_gatekeeper();

      // get the form input
      $receiver = get_input('send_to');
      $gift_id = get_input('gift_id');
      $body = get_input('body');
      $cost = get_input('giftcost');
      $access = get_input('access');

      $sender = get_entity(elgg_get_logged_in_user_guid());

      // No Friend selected?
      if (empty($receiver) || empty($gift_id)) {
          register_error(elgg_echo("gifts:blank"));
          forward("gifts/".$sender->name."/sendgift");
      }

      // Userpoints
      $useuserpoints  = elgg_get_plugin_setting('useuserpoints', 'gifts');
      if($useuserpoints == 1 && function_exists('userpoints_subtract')) {
          $pTemp = userpoints_get(elgg_get_logged_in_user_guid());
          $points = $pTemp['approved'];

          // Set new Point Value
          if(userpoints_subtract(elgg_get_logged_in_user_guid(), $cost, 'gifts')) {
              system_message(elgg_echo('gifts:pointsuccess'));
          }else{
              system_message(elgg_echo('gifts:pointfail'));
          }
      }

      // create a gifts object
      $gift = new ElggObject();
      $gift->description = $body;
      $gift->receiver = $receiver;
      $gift->gift_id = $gift_id;
      $gift->subtype = "gift";
      $gift->description = "value";

      $gift->access_id = $access;

      $gift->owner_guid = elgg_get_logged_in_user_guid();

      // save to database
      $gift->save();

      $sender = get_entity(elgg_get_logged_in_user_guid());
      $msgto = get_entity($receiver);

      // send mail notification
      global $CONFIG;
      notify_user($msgto->getGUID(), $sender->getGUID(), elgg_echo('gifts:mail:subject'),
          sprintf(
                  elgg_echo('gifts:mail:body'),
                  $sender->name,
                  $CONFIG->wwwroot . "gifts/" . $msgto->username . "/index"
                 )
      );

      // Add to river
      [0] := Gift Name <- 'Gift-Text' ? <-- $body | Description ??
      add_to_river('river/object/gifts/create','gifts',$gift->owner_guid,$gift->discription,$gift->receiver);
      system_message(elgg_echo('gifts:sendok'));

      // display gift
      forward("gifts/".$sender->name."/sent");

       

    • '500' means diddley in this context ;) --- caused by *anything (else) at all... yr server logs will say what's causing #500. my guess = you did(or not do) <something *else> to trigger '500'; code above is north & south poles apart re: 500. and by the way - the code i pasted is suggested pseudo (commented out:-oO) code only not full & real code b/c not wanna steal fun of discovering solution from the send.php code by oneself ;-P -> can be fun..

       

       

    • To be able to include the name of the gift in the river entry you first need to modify the add_to_river() call in /action/send.php because this function only allows to include two Elgg object guids to be used in the river entry. Currently, the user sending the gift is included as "subject_guid" and the user receiving the gift is included as "object_guid". Unfortunately, it's not possible to retrieve the gift name later on using these Elgg objects. But by changing the line to

      add_to_river('river/object/gifts/create','gifts',$gift->owner_guid,$gift->getGUID());

      the gift name will be accessible and the receiver name can also be retrieved.

      The second problem is to handle river entries for gifts sent that were created prior the change. Unfortunately, these entries will not be changeable and will still not include the gift name. So, the file views/default/river/object/create.php has to be modified accordingly:

      <?php
      /**
       * Elgg Gifts plugin
       * Send gifts to you friends
       *
       * @package Gifts
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Christian Heckelmann
       * @copyright Christian Heckelmann
       * @link http://www.heckelmann.info
       */

      // THANK YOU DDFUSION
      // Added Fix from DDFusion

      $performed_by = get_entity($vars['item']->subject_guid);

      $gift = get_entity($vars['item']->object_guid);
      if($gift->receiver) {
          $performed_on = get_entity($gift->receiver);
          $object = get_entity($gift->receiver);
          $gifttext = elgg_get_plugin_setting('gift_'.$gift->gift_id, 'gifts');
      } else {
          $performed_on = get_entity($vars['item']->object_guid);
          $object = get_entity($vars['item']->object_guid);
          $gifttext = elgg_echo("gifts:gift");
      }

      $person_link = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
      $object_link = "<a href=\"{$performed_on->getURL()}\">{$performed_on->name}</a>";
      $gift = "<a href=\"{$vars['url']}gifts/{$_SESSION['user']->username}/index\">{$gifttext}</a>";

      $string = sprintf(elgg_echo("gifts:river"), $object_link, $gift)  . " <a href=\"{$performed_by->getURL()}\">" . $performed_by->name . "</a> ";

      echo elgg_view('river/elements/layout', array(
              'item' => $vars['item'],
              'message' => $string,
      ));

      You might also want to modify the language strings accordingly, or even include two different strings for old and new river entries. Additionally, it seems necessary to add the language string

      'river:gifts:object:default'  =>  "A new gift was sent!",

      to the language file, because this string is called by Elgg automatically (maybe starting with Elgg 1.8.3?).

  • so it would be 'types' => 'object','subtypes' => 'messageboard_comments',   ???? view reply