Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Justin
    Participant

    @justineterniawebcom

    @andrewgtibbetts where di you end up with this? Would love blog comments to show up as notifications.


    Justin
    Participant

    @justineterniawebcom

    Actually solved it by limiting the post count in the loop and then adding this link to the archive of author posts wordpress already innately displays:

    This is the href:

    href="<?php echo get_site_url(); ?>/author/<?php echo the_author_meta( 'user_login' ); ?>

    In case anybody else needs to reference this post like I did.


    Justin
    Participant

    @justineterniawebcom

    I couldn’t get any of those hooks to work. I ended up editing the members.php file in the profile progression plugin and that worked. Obviously not ideal for updating plugins but it’s working!

    I also was then able to hide the progression bar from users who didn’t own that profile and hide it altogether once it was complete. Those features weren’t part of the original plugin.

    Here’s the code if anybody wants it:

    if (bp_is_my_profile()) {
    
    
        $percent = bppp_get_user_progression_percent();
    
        if ($percent == 100 && !current_user_can('edit_posts')) {
                    my_update_profile_mark();
        }
    
        if ($percent == 100) {
           echo '<div class="bppp-stat-no-display">';
    
        } else {
            echo '<div class="bppp-stat">';
        }
    
    
                echo '<span class="bppp-stat-title">';
                bppp_title();
                echo '</span> ';
                
                echo '<div class="bppp-stat-block">';
                        echo '<div class="bppp-bar">';
                echo '<div class="bppp-bar-mask" style="width:';
                echo (int)(100-bppp_get_user_progression_percent());
                echo '%"></div>';
                echo '</div>';
                        
                echo '</div>';
                echo '<span class="bppp-stat-percent">';
                echo bppp_get_user_progression_percent();
                echo '%</span>';
                echo '</div>';
    
    }
    

    Here’s the function that’s referenced that I added to functions.php:

    function my_update_profile_mark() {
    
       $user_ID = get_current_user_id();
       $power_level = 9001;
       update_user_meta( $user_ID, '_power_level', $power_level);
       
    }

    Oh and of course this got added to style.css:

    .bppp-stat-no-display {
        display: none;
    }
    

    Now I just need to build a custom menu in the backend that queries users based on their role level and the custom user meta key that’s updated here. Hopefully it’s a smoother process!

    Thanks all for your help!


    Justin
    Participant

    @justineterniawebcom

    @Henry, your code above was helpful. Couldn’t figure out how to loop user-specific posts on profiles. It’s all done now except, do you have any ideas on making pagination work? Googling around query_post() apparently has issues with navigation but usually the issue is displaying the same content on every page.

    In my case it just redirects to a 404 if I try using the pagination. Any ideas?

    This seemed to get the closest in addressing it but doesn’t fix this specific problem: https://wordpress.org/support/topic/page-navigation-038-query_posts


    Justin
    Participant

    @justineterniawebcom

    It’s not working 🙁 I even tested it as simple as possible. (The original first snippet above with no conditionals but with ‘add_action( ‘xprofile_profile_field_data_updated’, ‘my_update_profile_mark’ );’ instead. It seems like ‘xprofile_profile_field_data_updated’ isn’t firing. Any way ideas what I’m doing wrong?


    Justin
    Participant

    @justineterniawebcom

    That’s great @henrywright! Thank you! I will try it out. It seems like if this works, then my first snippet in the original post should’ve at least updated the meta when I was testing it. But hopefully this will be different!


    Justin
    Participant

    @justineterniawebcom

    That’s a great idea @shanebp! I looked at that plugin before but didn’t dive into the code much.

    It looks like there’s a function bppp_get_user_progression_percent() that can be used.

    Should this work?

    function my_update_profile_mark() {
    $percentage = echo bppp_get_user_progression_percent();
    
    if ($percentage == 100 && !current_user_can('edit_posts')) {
       $user_ID = get_current_user_id();
       $power_level = 9000;
       add_user_meta( $user_ID, '_level_of_power', $power_level);
       }
    }
    add_action( ‘xprofile_profile_field_data_updated’, ‘my_update_profile_mark’ );

    Again, I’m pretty new to PHP so I might be missing something here. I added the user capability check because editing/creating posts is a capability they earn after completing their profile. So it checks to see if they’ve already been promoted.


    Justin
    Participant

    @justineterniawebcom

    So to summarize, we need:

    1. To hook into xprofile_profile_field_data_updated
    2. We need the hooked function to check for empty profile fields in the main tab
    3. If there are no empty fields, it needs to notify the admin – via updating a custom meta key and sending the admin an email, preferably. But we can settle for just the meta key updated.

    Justin
    Participant

    @justineterniawebcom

    Ya all the fields in the main tab (or at least all the required fields).

    For some reason wp_mail is having conflicts with our site so we may need to just update a custom user meta field instead. That’s what the code above is attempting to do, but it doesn’t seem to add the meta key. If that can work, we can keep track of who is updated by who has that meta key.

    xprofile_profile_field_data_updated is helpful – thank you!

    Seems like xprofile_updated_profile wasn’t firing at all, whether on successful or unsuccessful attempts. Or at least it wasn’t updating the meta key in the first code snippet above.


    Justin
    Participant

    @justineterniawebcom

    Anyone have any ideas?


    Justin
    Participant

    @justineterniawebcom

    Would there be a way to make all activity spam by default? Would that have repercussions with akismet and blacklisting – if it could even be done simply enough? The ideal would be to send all activity to moderation by default, but this idea might do until a better solution can be found.

Viewing 11 replies - 1 through 11 (of 11 total)
Skip to toolbar