Skip to:
Content
Pages
Categories
Search
Top
Bottom

userpro topics replies for users in profile page

  • @siddardha

    Participant

    hello,

    i am using a plugin “user pro for social login”

    with custom css the profile of bbpress is changed into user pro profile page, you can have a look at cahive.com/profile/siddardha

    i want to insert the “topics and replies posted” by the user using shortcodes or any other method possible on the users profile page.

    thank you for your help.

Viewing 21 replies - 1 through 21 (of 21 total)
  • @robin-w

    Moderator

    the code that profile uses is

    <p class="bbp-user-topic-count"><?php printf( __( 'Topics Started: %s',  'bbpress' ), bbp_get_user_topic_count_raw() ); ?></p>
    			<p class="bbp-user-reply-count"><?php printf( __( 'Replies Created: %s', 'bbpress' ), bbp_get_user_reply_count_raw() ); ?></p>

    The function is expecting the profile user to be in a variable called $user_id

    Suggest you refer to the userpro support site for how to integrate this

    @siddardha

    Participant

    hello,

    thank you,it worked.

    but is there a way, users viewing a profile can be able to see the topics and replies when the links are clicked? this would be much better.

    thank you once again.

    @robin-w

    Moderator

    That is what the original code does in profile – what happens when you click the links?

    @siddardha

    Participant

    please take a look here http://cahive.com/profile/siddardha/

    i have already created some test topics, but they do not appear nor the linkbe clicked.

    @robin-w

    Moderator

    ok, the function needs the existence of a variable called $user_id (being the wordpress usreid of the profile user.

    How/where are you adding this code?

    @siddardha

    Participant

    in userpro plugin templates/view.php file

    this has already been discused in the userpro forum, please take a look here

    @robin-w

    Moderator

    can you post the view.php template with your added code here please

    @siddardha

    Participant

    hey robin, here is the entire code:

    <div class=”userpro userpro-<?php echo $i; ?> userpro-id-<?php echo $user_id; ?> userpro-<?php echo $layout; ?>” <?php userpro_args_to_data( $args ); ?>>

    <?php _e(‘Close’,’userpro’); ?>

    <div class=”userpro-centered <?php if (isset($header_only)) { echo ‘userpro-centered-header-only’; } ?>”>

    <?php if ( userpro_get_option(‘lightbox’) && userpro_get_option(‘profile_lightbox’) ) { ?>
    <div class=”userpro-profile-img” data-key=”profilepicture”>profile_photo_url($user_id); ?>” class=”userpro-tip-fade lightview” data-lightview-caption=”<?php echo $userpro->profile_photo_title( $user_id ); ?>” title=”<?php _e(‘View member photo’,’userpro’); ?>”><?php echo get_avatar( $user_id, $profile_thumb_size ); ?></div>
    <?php } else { ?>
    <div class=”userpro-profile-img” data-key=”profilepicture”>permalink($user_id); ?>” title=”<?php _e(‘View Profile’,’userpro’); ?>”><?php echo get_avatar( $user_id, $profile_thumb_size ); ?></div>
    <?php } ?>
    <div class=”userpro-profile-img-after”>
    <div class=”userpro-profile-name”>
    permalink($user_id); ?>”><?php echo userpro_profile_data(‘display_name’, $user_id); ?><?php echo userpro_show_badges( $user_id ); ?>
    </div>
    <?php do_action(‘userpro_after_profile_img’ , $user_id); ?>
    <?php if ( userpro_can_edit_user( $user_id ) ) { ?>
    <div class=”userpro-profile-img-btn”>
    <?php if (isset($header_only)){ ?>
    permalink($user_id, ‘edit’); ?>” class=”userpro-button secondary”><?php _e(‘Edit Profile’,’userpro’) ?>
    <?php } else { ?>
    id_to_member($user_id); ?>” data-template=”edit” class=”userpro-button secondary”><?php _e(‘Edit Profile’,’userpro’); ?>
    <?php } ?>
    skin_url(); ?>loading.gif” alt=”” class=”userpro-loading” />
    </div>
    <?php } ?>
    </div>

    <div class=”userpro-profile-icons top”>
    <?php if (isset($args[‘permalink’])) {
    userpro_logout_link( $user_id, $args[‘permalink’], $args[‘logout_redirect’] );
    } else {
    userpro_logout_link( $user_id );
    } ?>
    </div>

    <?php echo $userpro->show_social_bar( $args, $user_id, ‘userpro-centered-icons’ ); ?>

    <div class=”userpro-clear”></div>

    </div>

    <?php if (!isset($header_only)) { ?>

    <?php
    // action hook after user header
    if (!isset($args[‘disable_head_hooks’])){
    if (!isset($user_id)) $user_id = 0;
    $hook_args = array_merge($args, array(‘user_id’ => $user_id, ‘unique_id’ => $i));
    do_action(‘userpro_after_profile_head’, $hook_args);
    }
    ?>

    <div class=”userpro-body”>

    <?php do_action(‘userpro_pre_form_message’); ?>

    <form action=”” method=”post” data-action=”<?php echo $template; ?>”>

    <input type=”hidden” name=”user_id-<?php echo $i; ?>” id=”user_id-<?php echo $i; ?>” value=”<?php echo $user_id; ?>” />

    <?php // Hook into fields $args, $user_id
    if (!isset($user_id)) $user_id = 0;
    $hook_args = array_merge($args, array(‘user_id’ => $user_id, ‘unique_id’ => $i));
    do_action(‘userpro_before_fields’, $hook_args);
    ?>

    <?php foreach( userpro_fields_group_by_template( $template, $args[“{$template}_group”] ) as $key => $array ) { ?>

    <?php if ($array) echo userpro_show_field( $key, $array, $i, $args, $user_id ) ?>

    <?php } ?>

    <?php // Hook into fields $args, $user_id
    if (!isset($user_id)) $user_id = 0;
    $hook_args = array_merge($args, array(‘user_id’ => $user_id, ‘unique_id’ => $i));
    do_action(‘userpro_after_fields’, $hook_args);
    ?>

    <?php // Hook into fields $args, $user_id
    if (!isset($user_id)) $user_id = 0;
    $hook_args = array_merge($args, array(‘user_id’ => $user_id, ‘unique_id’ => $i));
    do_action(‘userpro_before_form_submit’, $hook_args);
    ?>

    <?php if ( userpro_can_delete_user($user_id) || $userpro->request_verification($user_id) || isset( $args[“{$template}_button_primary”] ) || isset( $args[“{$template}_button_secondary”] ) ) { ?>
    <div class=”userpro-field userpro-submit userpro-column”>

    <?php if ( $userpro->request_verification($user_id) ) { ?>
    <input type=”button” value=”<?php _e(‘Request Verification’,’userpro’); ?>” class=”popup-request_verify userpro-button secondary” data-up_username=”<?php echo $userpro->id_to_member($user_id); ?>” />
    <?php } ?>

    <?php if ( userpro_can_delete_user($user_id) ) { ?>
    <input type=”button” value=”<?php _e(‘Delete Profile’,’userpro’); ?>” class=”userpro-button red” data-template=”delete” data-up_username=”<?php echo $userpro->id_to_member($user_id); ?>” />
    <?php } ?>

    <?php if (isset($args[“{$template}_button_primary”]) ) { ?>
    <input type=”submit” value=”<?php echo $args[“{$template}_button_primary”]; ?>” class=”userpro-button” />
    <?php } ?>

    <?php if (isset( $args[“{$template}_button_secondary”] )) { ?>
    <input type=”button” value=”<?php echo $args[“{$template}_button_secondary”]; ?>” class=”userpro-button secondary” data-template=”<?php echo $args[“{$template}_button_action”]; ?>” />
    <?php } ?>

    skin_url(); ?>loading.gif” alt=”” class=”userpro-loading” />
    <div class=”userpro-clear”></div>

    </div>
    <?php } ?>

    </form>

    </div>

    <?php } ?>

    </div>
    <p class=”bbp-user-topic-count”><?php printf( __( ‘Topics Started: %s’, ‘bbpress’ ), bbp_get_user_topic_count_raw() ); ?></p>
    <p class=”bbp-user-reply-count”><?php printf( __( ‘Replies Created: %s’, ‘bbpress’ ), bbp_get_user_reply_count_raw() ); ?></p>

    @robin-w

    Moderator

    ok, I’d do two things

    1. move the code to above </form> line
    2. Try it with the following to force bbpress to take the id

    <p class=”bbp-user-topic-count”><?php printf( __( ‘Topics Started: %s’, ‘bbpress’ ), bbp_get_user_topic_count_raw($user_id) ); ?></p>
     <p class=”bbp-user-reply-count”><?php printf( __( ‘Replies Created: %s’, ‘bbpress’ ), bbp_get_user_reply_count_raw($user_id) ); ?></p>

    `

    @arpitg

    Participant

    hello Robin,

    When I copied this code above </form> tag
    <p class=”bbp-user-topic-count”><?php printf( __( ‘Topics Started: %s’, ‘bbpress’ ), bbp_get_user_topic_count_raw($user_id) ); ?></p>
    <p class=”bbp-user-reply-count”><?php printf( __( ‘Replies Created: %s’, ‘bbpress’ ), bbp_get_user_reply_count_raw($user_id) ); ?></p>

    then find a syntax error
    Parse error: syntax error, unexpected ‘Started’ (T_STRING) in /home/cahiveco/public_html/wp-content/plugins/userpro/templates/view.php on line 110

    @robin-w

    Moderator

    can you post lines 108-114 here please

    @arpitg

    Participant

    </div>
    <?php } ?>
    <p class=”bbp-user-topic-count”><?php printf( __( ‘Topics Started: %s’, ‘bbpress’ ), bbp_get_user_topic_count_raw($user_id) ); ?></p>
    <p class=”bbp-user-reply-count”><?php printf( __( ‘Replies Created: %s’, ‘bbpress’ ), bbp_get_user_reply_count_raw($user_id) ); ?></p>
    </form>

    </div>

    @robin-w

    Moderator

    ok, can’t immediately see what it is unhappy with

    need to work out if it is position or what I added

    try

    moving it to where it was
    putting the previous code into the new position

    that should tell us which

    @arpitg

    Participant

    i’ve changed previous code

    @robin-w

    Moderator

    and…..?????

    @robin-w

    Moderator

    sorry what does that mean?

    @robkk

    Moderator

    @siddardha , @arpitg

    i think the plugin author should just incorporate this type of thing into their plugin.

    just tell them that you want more bbPress plugin integration to show topics/replies created on the user profile.

    they can probably add the little fancy dropdown/menu item and everything too.

    @siddardha

    Participant

    hello,

    the plugin author helped, here is the code

    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <div id=”bbp-user-topics-started” class=”myforumtest”>
     
    <div class=”bbp-user-section”> <h2 class=”entry-title”><?php _e( 'Forum Topics Started', 'bbpress'); ?></h2>
     
    <?php if ( bbp_get_user_topics_started( $user_id, 'topics-created') ) : ?>
     
    <?php bbp_get_template_part( 'pagination', 'topics' ); ?>
     
    <?php bbp_get_template_part( 'loop', 'topics' ); ?>
     
    <?php else : ?>
     
    <p><?php bbp_is_user_home() ? _e( 'You have not created any topics.', 'bbpress') : _e( 'This user has not created any topics.', 'bbpress' ); ?></p>
     
    <?php endif; ?>
     
    </div>
    </div>

    @robin-w

    Moderator

    great – so you are fixed?

    @siddardha

    Participant

    yes and a lot thanks to you, i have mailed them this topic link too

    @robin-w

    Moderator

    great !

Viewing 21 replies - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.
Skip to toolbar