HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Test results on embed-friendly, mobile, and some other themes

peregrineperegrine MVP
edited July 2012 in Feedback

the menu item wouldn't showup in the embed-friendly, mobile and some other themes.

I made a modification (don't know if was a good or bad idea, but it solved the problem for me)

// class MembersListPlugin implements Gdn_IPlugin{
class MembersListPlugin extends Gdn_Plugin{

 public function Base_Render_Before($Sender) {
  // Adds a menu item. Removes the last (signout) adds the new one, then re-adds the signout.
 // public function MenuModule_BeforeToString_Handler(&$Sender) {
    if(Gdn::Session()->IsValid()){
   //  $lastElement = end($Sender->Items);
   //  $Sender->RemoveGroup('SignOut');
   //  $Sender->AddLink('Members', T('Members'), 'plugin/MembersList/');
       $Sender->Menu->AddLink('Members', T('Members'), 'plugin/MembersList/');
   //  $Sender->Items[] = $lastElement;
    }
  }

learned a few things I didn't realize one could do from a plugin - thanks

I don't think it is necessary to use &$Sender in php5.3 or above $Sender is sufficient.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • csakipcsakip New
    edited July 2012

    @peregrine: Thank you for the info. I will add your modifications on the next version if that's okay with you.

  • no problem with me.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited July 2012

    based on suggestions from Todd, Tim, and Lincoln

    move memberlist.view.php
    
    /plugins/MembersList/views/memberslist.php
    
    and change
     
      $Sender->Render('MembersList', '', 'plugins/MembersList');
      
     // $Sender->Render(dirname(__FILE__).DS.'memberlist.view.php');
     $Sender->Render('MembersList', '', 'plugins/MembersList');
    
    

    Also, do you plan to add pagination, sorting, viewing permissions, dashboard settings, and optional column viewing like ip address, and selection criteria like last login date, etc.

    And do you want some help in adding those @csakip . I think some people would like a bunch more options, and your plugin is a great start.

    also

    public function PluginController_MembersList_Create(&$Sender){
    
    to
    
    public function PluginController_MembersList_Create($Sender){
    
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thanks again. Also thanks to the dev team. I saw the other discussion about this but I can't post there.

    Actually I haven't planned to implement those features because I saw that Aolee has a plugin like this for a few bucks and I don't want to interfere with his business. But since ppl need this function I made a basic one. Something like Paint in windows. :D

  • csakip said:
    Thanks again. Also thanks to the dev team. I saw the other discussion about this but I can't post there.

    Actually I haven't planned to implement those features because I saw that Aolee has a plugin like this for a few bucks and I don't want to interfere with his business. But since ppl need this function I made a basic one. Something like Paint in windows. :D

    his plugin seems not freely :-( not shared here, is not ?

    pagination is to my mind the first feature to do :-) tried to copy&paste it from other plugins but nothing working...

    it will be great if we could do sorting by alphabetical (it's made like this), last login date order (to do) and why not :) post number for example

    but ;-) thank you @csakip for this starting...

  • it seem that the following dashbord's links are broken :-( now... is not ?

    • Users: Authentication
    • Forum: Media (related to FileUpload plugin)

    Fatal error: Call to a member function AddLink() on a non-object in /.../plugins/MembersList/default.php on line 16

    no time to do more tonight :) see you soon (for more feedback)

  • peregrineperegrine MVP
    edited August 2012

    look at the code I posted.

    the user of members and member without the s provided inconsistencies.

    read closely members

    http://vanillaforums.org/discussion/comment/165702/#Comment_165702

    if you do "exactly" as I posted - it does work - unless FileUpload conflicts.

    I don't have the Fileupload plugin loaded - why do you get FileUpload plugin problem Is that a conflict?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Pamela said:
    it seem that the following dashbord's links are broken :-( now... is not ?

    • Users: Authentication
    • Forum: Media (related to FileUpload plugin)

    Fatal error: Call to a member function AddLink() on a non-object in /.../plugins/MembersList/default.php on line 16

    no time to do more tonight :) see you soon (for more feedback)

    1) cut and paste your default.php, highlight it and click the "C" button if you still have problems and

    2) list all the file names including any backups etc in your /plugins/MembersList directories.

    3) look at previous message.

    4) specifically post line 16 in /MembersList/default.php ?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrine said:

    1) cut and paste your default.php, highlight it and click the "C" button if you still have problems and

    2) list all the file names including any backups etc in your /plugins/MembersList directories.

    3) look at previous message.

    4) specifically post line 16 in /MembersList/default.php ?

    Many thanks for your support and :) patience

    your 2nd step could be the reason, my backup file was named like this _default.php ;-) and it seems that isn't a good idea with Vanilla (recently I noticed strange things with an other plugin vs my back-up file which still stored in this plugin directory)

    I 'll check it a last time :) before copy&paste it here, see you soon !

  • peregrine said:

    if you do "exactly" as I posted - it does work - unless FileUpload conflicts.

    I 'll re re start it slowly :) step by step

    I don't have the Fileupload plugin loaded - why do you get FileUpload plugin problem Is that a conflict?

    line 78 seen this famous &$Sender like this
    public function Base_GetAppSettingsMenuItems_Handler($Sender) { $Menu = &$Sender->EventArguments['SideMenu'];

    https://github.com/vanillaforums/Addons/blob/master/plugins/FileUpload/class.fileupload.plugin.php

    no way, can't be the cause ?

  • @Pamela check your messages

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited August 2012

    @pamela

    peregrine said:
    the menu item wouldn't showup in the embed-friendly, mobile and some other themes.

    I made a modification (don't know if was a good or bad idea, but it solved the problem for me)

      
    
    
      //   class MembersListPlugin implements Gdn_IPlugin{
    class MembersListPlugin extends Gdn_Plugin{

    public function Base_Render_Before($Sender) {
    // Adds a menu item. Removes the last (signout) adds the new one, then re-adds the signout.
    // public function MenuModule_BeforeToString_Handler(&$Sender) {
    if(Gdn::Session()->IsValid()){
    // $lastElement = end($Sender->Items);
    // $Sender->RemoveGroup('SignOut');
    // $Sender->AddLink('Members', T('Members'), 'plugin/MembersList/');
    $Sender->Menu->AddLink('Members', T('Members'), 'plugin/MembersList/');
    // $Sender->Items[] = $lastElement;
    }
    }

    perhaps I added a problem that may be corrected.

    I think the conflict with other plugins might be solved if it were this.

    public function Base_Render_Before($Sender) {
         $Session = Gdn::Session();
        if ($Sender->Menu && $Session->IsValid()) {
        $Sender->Menu->AddLink('Members', 'Members', 'plugin/MembersList');
        }
      }
    
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited August 2012

    @pamela and @nepheus

    so the complete change to default.php

    <?php
    if(!defined('APPLICATION')) die();
    
    $PluginInfo['MembersList'] = array(
        'Version' => '1.1B',
        'Name' => 'Members List - fix by peregrine',
        'Description' => 'Simple members list.',
      'AuthorEmail' => 'csakip@freemail.hu',
        'Author' => 'csakip'
    );
    
    class MembersListPlugin extends Gdn_Plugin{
    
    
      // Adds a menu item. Thanks to peregrine for this better solution!
    
    
    public function Base_Render_Before($Sender) {
    $Session = Gdn::Session();
    if ($Sender->Menu && $Session->IsValid()) {
    $Sender->Menu->AddLink('Members', 'Members', 'plugin/MembersList');
    }
    }
    
    
    
    
    
        public function PluginController_MembersList_Create($Sender){
        if(Gdn::Session()->IsValid()){
            $Sender->ClearCssFiles();
            $Sender->AddCssFile('style.css');
            $Sender->MasterView = 'default';
    
          $Sender->UserData = Gdn::SQL()->Select('User.*')->From('User')->OrderBy('User.Name')->Where('Deleted',false)->Get();
          RoleModel::SetUserRoles($Sender->UserData->Result());
    
            $Sender->Render('MembersList', '', 'plugins/MembersList');
        }
        }
    
        public function Setup(){
        }
    
    }
    

    and also make sure you

    move memberlist.view.php

    TO:

    /plugins/MembersList/views/memberslist.php

    in the end there should be no memberlist.view.php in your plugin directory.

    and there should be a /plugins/MembersList/views/memberslist.php

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrine said:
    @pamela and @nepheus

    so the complete change to default.php

    Many thanks @peregrine for your support and attempt to help us

    My 'authentication' and 'media' problem is fixed :) using this most recent default.php version

    peregrine said:
    @pamela and @nepheus

    in the end there should be no memberlist.view.php in your plugin directory.

    you 're right :) one more time

    I didn't erase it at the beginning and it seems it was an issue

  • AoleeAolee Hobbyist & Coder ✭✭

    wow great work csakip! that's also a good way of displaying members (table view)

    i was so busy with my new job hitting deadlines and haven't visited vanilla for ages, i can say a lot has changed.

    well... for those people wanting to have a FREE memberlist plugin with pagination, i'll try to find some time to mod this plugin.

    @csakip : btw, thanks for considering my paid memberlist plugin :)

Sign In or Register to comment.