Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • One other feature suggestion that would be very helpful:

    I made another mod which displays a clickable email icon next to each entry when listing out the directory. When clicked, the private message compose form comes up with the “To:” user id pre-populated (this is a standard BP URL for compose) for all users except the logged in user. The logged in user instead gets a link saying “Edit your profile”.

    These are to me very useful, but rather than asking you to add something like this, would it be possible to introduce the concept of having a dud folder under the child theme folder similar to what buddypress as a plugin provides? This way, an alternate version of the plugin files could be maintained here and not be impacted when the plugin itself is upgraded.

    Thanks in advance for your consideration.

    Dennis

    That’s music to my ears – thanks! Just last night I was trying to work out the sorting by display name which was broken with my hack. Now I will just wait until that version comes out instead. (and not install any updates that come out in the meantime).

    Thanks for your help!

    Dennis

    Hi Sarah,

    I made a small modification to your plugin that allows me to achieve the “single term search” as I have dubbed it. The mod is a bit crude and does not pretend to fully integrate with all of the other DUD features, but I don’t think that would be too hard to do that if you wanted to make it available as part of the core functionality. In any case, here are the changes:

    1) Add a new optional input to the dud_build_directory_query() function in core.php as follows (last argument):

    function dud_build_directory_query(..., $single_term=NULL) {}

    2) At the very end of the function right before the query syntax is returned, add this statement:

    if (isset($single_term)) {$user_sql = 'SELECT DISTINCT bp.user_id from wp_bp_xprofile_data bp INNER JOIN wp_users wp ON wp.id = bp.user_id WHERE bp.value LIKE "%' . $single_term . '%" ORDER BY wp.display_name';                
           } 
    return $user_sql;

    3) Add the following argument in DynamicUserDirectory() in the 2 instances where dud_build_directory_query() is called (lines 317 and 2033 in v. 1.8), also as last argument:

    $user_sql = dud_build_directory_query(..., $_GET['term']);

    Now on the page having the [DynamicUserDirectory] shortcode, e.g. http://www.mydomain/member-directory I can add an input field and button which calls the page with a URL argument containing the search term, i.e.

    http://www.mydomain/member-directory?term=electronics

    The directory will then be displayed filtered for all BP (xprofile) fields containing the string “electronics”.

    A final version of this should probably only search fields that are defined in the DUD settings + a few other refinements I am sure.

    Please let me know your thoughts.

    Thanks

    Dennis

    • This reply was modified 9 months, 3 weeks ago by dwl003.
    • This reply was modified 9 months, 3 weeks ago by dwl003.

    Hi guys,

    Same issue – I suspect some sort of plugin conflict. In any case, here is a quick and dirty solution which worked for me (this code only sends succesfull login notifications to the admin email, but similar code could be put in to notify on failed logins etc.)

    Just deactivate the plugin and add this code to your child themes functions.php instead and you will get the emails:

    function dwl_login_notify( $user_login, $user ) {
        $user_id = $user->email; // get user id
        $admin_email = get_option( 'admin_email', $default = 'NA' );    
        wp_mail(  $admin_email, $user_login . ' logged in just now <end>', $user_login . ' logged in just now <end>', '', '' )  ;
    }
    add_action( 'wp_login', 'dwl_login_notify', 10, 2 );

    Thanks,

    Dennis

    • This reply was modified 10 months, 2 weeks ago by dwl003.

    Hi Mandeep,

    In the mean time, I re-read the plugin documentation and came across the “hide_files” tag, tested it and it actually worked! It did take a bit to fiddle with the paths to find the right config, but it definitely works for me.

    Thanks for a great plugin

    Dennis

    OK just looping back on this. I did a clean install, with no plugins and using the default theme. I setup a private post and can confirm that it can be viewed by users with the Editor role but not the Subscriber role, so I will have to drill down and find which plugin modified this behavior.

    With regards to the plugin you suggested, it worked fine on the clean install, then I removed the custom code and installed the plugin on the live site and that worked as well so not sure what I did wrong when I initially tested it (forgot to activate it perhaps??).

    In any case I think I am good for now.

    I appreciate your help as I am a bit of a newbie 🙂

    Thanks

    Dennis

    Hi Joy,

    Thanks for the quick response. Actually, when I setup new users with Subscriber or Editor role, they are able to view Private Posts. I have admittedly played around with a lot of plugins which may have modified the behavior of this, but to prove/disprove this, I will try to do a new clean install without plugins and test this.

    I do also see conflicting info on the topic:

    As you say, this document says administrators only: https://codex.wordpress.org/Post_Status

    however this document says Editor’s also:

    https://codex.wordpress.org/Content_Visibility

    In any case, I now have everything working correctly where my Subscribers and Editors can view the posts (except for the issue I am having with saving public posts).

    Also, I did try the plugin you quoted but couldnt get it to work. I will also try this in a clean new instance to see how it works.

    But I would still be curious to know if there is a tweak that could be done to the code in my original post?

    Thanks again,

    Dennis

Viewing 7 replies - 1 through 7 (of 7 total)