Please or Register to create posts and topics.

Help with integration with Front End PM

Page 1 of 2Next

Hi,

I would like to know if you can assist in placing some code into my theme’s function file.  What I want to do is to place a private message plugin, for which there is a way to do so, but I don’t know the hooks to your plugin.

The code that i’ll provide (see below) works with bbpress, but for Asgaros Forum, I wouldn’t know.

Please let me know how it would work.

add_action( 'bbp_theme_after_reply_author_details', function() {

    $user_nicename = get_the_author_meta('user_nicename');

    if( ! $user_nicename || ! fep_current_user_can('send_new_message_to', $user_nicename ) ){
        return '';
    }
    ?>
        <div class="fep-bp-send-message"><?php echo do_shortcode( "[fep_shortcode_message_to class='fep-bp-send-message-a']"); ?></div>
    <?php
});

 

Uploaded files:
  • fep-bbpress-integration.png

Hello @goldstrikn

You can use the following code to add custom content under the post-authors details:

function custom_links($user_id, $post_counter) {
  echo 'My code ...';
}
add_action('asgarosforum_after_post_author', 'custom_links', 10, 2);

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks for the info.  That helped to get me started.

Now,  I ran into an issue in relation to the author of the post.  What I need to know is what is the tag for Asgaro author?

When I use post_author, it takes the page author, rather than the author of the thread discussion.  I hope you know what I mean.

Please let me know if it is different than post_author.

Hello @goldstrikn

The variable $user_id always contains the ID of the user which wrote a post, so it should be safe to use.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks again, I got it sort it out.   One more thing in regards to contact button.  Can you help with a snippet of code to place the same contact button, but in the profile page?

I’m attaching the pic to where I’m referring.   I would like the contact button to be under the Replies Created count.

Please advise.

Thanks.

Uploaded files:
  • profile.JPG

Hello @goldstrikn

You can use the asgarosforum_custom_profile_content hook for this. The $user_object variable contains all necessary data:

function custom_profile_content($user_object) {
  // My code ...
  print_r($user_object);
}
add_action('asgarosforum_custom_profile_content', 'custom_profile_content');

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

@goldstrikn

I was looking for this … and after some researchs I put this code in my function.php file.

I have use an exemple from Yworld with WP Recall

I don’t know if it’s the best coding solution … because I’m not a pro … but its works great !!!

Now I have a message icon under each profil and each user name

You just have to click … and you are in the Front End PM page to write to the selected user !

Hope can this help you

//function my_menu() {

add_action(‘asgarosforum_after_post_author’, ‘my_function_asgaros_cabinet’, 30, 1);
function my_function_asgaros_cabinet($author_id) {
echo ‘<div>’;

$user = get_author_name($author_id);

echo ‘<a href=”http://your_site.com/messages/?fepaction=newmessage&fep_to=’.$user.'” title=”‘.__(‘Message Privé’,’rcl-asgaros’).'”><i style=”color:’.$rcl_options[‘color_font_icon’].’;” class=”fa fa-comment”></i></a>’;

echo ‘</div>’;

}

add_action(‘asgarosforum_custom_profile_content’, ‘my_function_asgaros_cabinet2’, 30, 1);
function my_function_asgaros_cabinet2($author_id) {
echo ‘<div>’;
$author_id = $_GET[‘id’];

$user = get_author_name($author_id);

echo ‘<a href=”http://your_site.com/messages/?fepaction=newmessage&fep_to=’.$user.'” title=”‘.__(‘Message Privé’,’rcl-asgaros’).'”><i style=”color:’.$rcl_options[‘color_font_icon’].’;” class=”fa fa-comment”></i> Message Privé</a>’;

echo ‘</div>’;

}

Uploaded files:
  • mp1.png
  • mp2.png
  • mp3.png
Asgaros has reacted to this post.
Asgaros

Thanks TOF, and Asgaros.  The code provided did the trick.

I have put the “Front END PM” plugin in a lightbox … is more flexible, without access to the forums Codex.

Quote from TOF on April 22, 2018, 12:35 am

@goldstrikn

I was looking for this … and after some researchs I put this code in my function.php file.

I have use an exemple from Yworld with WP Recall

I don’t know if it’s the best coding solution … because I’m not a pro … but its works great !!!

Now I have a message icon under each profil and each user name

You just have to click … and you are in the Front End PM page to write to the selected user !

Hope can this help you

//function my_menu() {

add_action(‘asgarosforum_after_post_author’, ‘my_function_asgaros_cabinet’, 30, 1);
function my_function_asgaros_cabinet($author_id) {
echo ‘<div>’;

$user = get_author_name($author_id);

echo ‘<a href=”http://your_site.com/messages/?fepaction=newmessage&fep_to=’.$user.'” title=”‘.__(‘Message Privé’,’rcl-asgaros’).'”><i style=”color:’.$rcl_options[‘color_font_icon’].’;” class=”fa fa-comment”></i></a>’;

echo ‘</div>’;

}

add_action(‘asgarosforum_custom_profile_content’, ‘my_function_asgaros_cabinet2’, 30, 1);
function my_function_asgaros_cabinet2($author_id) {
echo ‘<div>’;
$author_id = $_GET[‘id’];

$user = get_author_name($author_id);

echo ‘<a href=”http://your_site.com/messages/?fepaction=newmessage&fep_to=’.$user.'” title=”‘.__(‘Message Privé’,’rcl-asgaros’).'”><i style=”color:’.$rcl_options[‘color_font_icon’].’;” class=”fa fa-comment”></i> Message Privé</a>’;

echo ‘</div>’;

}

@asgaros Ich habe diesen Code bei mir eingefügt, doch leider funktioniert es nicht..

Hast DU noch zufällig einen Code bei dem Front End PM auch integriert wird ?

Page 1 of 2Next