Plugin: BuddyPress Moderation

Join this plugin group to follow comments, support topics and reviews.

Shortcodes (11 posts)

Started 1 year, 8 months ago by: James

  • Profile picture of James James said 1 year, 8 months ago:

    hi,

    first of all, thanks for the great plugin!
    one of plugin options is to add “flag” possibility to blog posts, when link is displayed below the post content.
    wanted to ask whether is it possible to use some shortcode to make/add this link/flag to the date box or postmetadata of the post or not?

    I’ve seen that there were some explanations in the faq, but for “skilled” people like me, some shortcode like would help a lot.

    thanks.

  • Profile picture of francescolaffi francescolaffi said 1 year, 7 months ago:

    hi @janismo,
    by default it place under the content because it’s the only hook I can be sure it’s in every theme.
    How to move it depends on the theme and you’ll need either to:
    -remove the content hook from content and use another hook you like(if your theme has it)
    -edit the theme files

    I don’t think is possible to do it with a shortcode and it’s not convenient too because you would have to use it in every post. If you have lot of themes in your community you would have to change every theme.

    If you need more help you need to say the theme you are using and where exactly you would like the link.

  • Profile picture of James James said 1 year, 7 months ago:

    @francescolaffi
    hi and thanks for reply,

    1. want to place in BP default below postmetabox (below bottom border of tags and comments count)

    2. “…I don’t think is possible to do it with a shortcode and it’s not convenient too because you would have to use it in every post. If you have lot of themes in your community you would have to change every theme. …”

    You mean, if I have community with X users subdomains, after site wide activation of your plugin flag link will appear on every blog below every post automatically?

    thank you.

  • Profile picture of francescolaffi francescolaffi said 1 year, 7 months ago:

    I don’t see any useful hook there, so you need to manually place it in the theme (better in a child theme). Check the WP codex on theme customization and the bpModFrontend::get_link() to generate the link.

    Yes content moderation is sitewide

  • Profile picture of stwc stwc said 1 year, 4 months ago:

    @francescolaffi – that last is exactly what I would like to do, for the main blog — place the flag in the comment metadata div, rather than attached to the actual blog comment content, basically for layout purposes. Could you offer a little help on how to use bpModFrontend::get_link() to generate the link? I understand where to put it in my comments template, but not sure how to use bpModFrontend::get_link() in terms of passing the arguments and stuff.

    Also, if manually adding it to the comments template, should the Blog Comment content type in the BP Moderation back end be switched off? (I assume so, but just making sure…)

    Thanks!

  • Profile picture of stwc stwc said 1 year, 4 months ago:

    Tried this, with no luck:

    <?php bpModFrontend::get_link(array('type' => 'blog_comment', 'author_id' => $comment->user_id,'id' => $wpdb->blogid,'id2' => $comment->comment_ID,'unflagged_text' => __('Flag this comment as inappropriate','bp-moderation'))); ?>

  • Profile picture of francescolaffi francescolaffi said 1 year, 4 months ago:

    @stwc at first look it is correct, but remeber that $wpdb and $comment are globals variables, so you could access them trough $GLOBALS['wpdb'] and $GLOBALS['comment'], or look for some wp function to get those info.

  • Profile picture of stwc stwc said 1 year, 4 months ago:

    Thanks for the advice, but nope, still no joy.

    I’ve checked and I’m definitely passing the correct values, but no flag link is appearing in the comment. The plugin works fine when I select Blog Comments as an item to moderate in the admin area, but when unselected in the backend, bpModFrontend isn’t writing a link beside comments…

  • Profile picture of francescolaffi francescolaffi said 1 year, 4 months ago:

    @stwc you may already have tried this but is not in the snippet you posted. That function returns, doesn’t print: either prepend echo or use bpModFrontend::link instead (same params).

    if this is not the problem please post a larger snippet and info about your environment and I’ll try to reproduce it

  • Profile picture of stwc stwc said 1 year, 4 months ago:

    Ah, that’s probably it. I should have tried that! Thanks, Frances! I’m away from my dev machine, but I’ll give that a try as soon as I can.

  • Profile picture of stwc stwc said 1 year, 4 months ago:

    That was it, indeed. Thanks again — it’s working fine now.