BuddyDev

Search

[Resolved] Flag Symbol Instead of 'Report'


  • Participant
    Level: Enlightened
    Posts: 78
    JohnnyNW on #26824

    Hello. I have a question regarding BuddyPress Moderation Tools.

    I noticed the default for button is ‘Report’, but looking at the code, I want to change the text to “R” or “F” without breaking the plugin.

    Once you can point me out what line of code I can change (without breaking the plugin), I’ll structure a button html and then assign the link in it through a tag to show a flag icon.

    Just trying to minimize the business on the eyes (lots of ‘Reports’) in Activities, so it would be nice to minimize its presence.


  • Keymaster
    (BuddyDev Team)
    Posts: 13067
    Brajesh Singh on #26827

    Hi,
    Thank you for the question.

    The simplest way to achieve it will be via translation. Please use any translation tool(poedit or a plugin) and change the label.

    Please let me know if that works for you or not?

    Regards
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 78
    JohnnyNW on #26842

    Not sure what you mean.

    If the code looked like this

    $custom_field_value .= '<div class="file"><a href="'.$custom_field_single_value.'" target="_blank">'.$custom_field_single_value.'</a></div>';

    I would have changed up the code to show the back ground text as an image like this

    $custom_field_value .= '<div class="file"><a href="'.$custom_field_single_value.'" target="_blank"><img src="'. get_template_directory_uri().'/flag.png" />'.$custom_field_single_value->src.'</a></div>';

    So, I was hoping you could direct me on where I would change up code to show a small icon flag without breaking the plugin 🙂 Or, what lines I can safely alter the text from “Report” to “R” 🙂

    Thanks in advance.


  • Participant
    Level: Enlightened
    Posts: 78
    JohnnyNW on #26913

    Hello, quick question:

    On line 52 in bpmts-template.php I changed Report to Flag $label = $args['label'] ? esc_html( $args['label'] ) : __( 'Report', 'buddypress-moderation-tools' );

    Now it looks like this $label = $args['label'] ? esc_html( $args['label'] ) : __( 'Flag', 'buddypress-moderation-tools' );

    Plugin seems to still work.

    Is this okay?

    I’m trying to minimize the button’s presence on activities.

    Thanks.


  • Keymaster
    (BuddyDev Team)
    Posts: 13067
    Brajesh Singh on #26918

    Hi,
    This will work fine but may I know why do you prefer this method over translation.

    Translation will allow you to keep the changes in future while with this method, It will be lost in next upgrade.

    PS:- If needed, I can help with how you can translate.

    Regards
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 78
    JohnnyNW on #26939

    Yes,I’m curious about translate, please 🙂


  • Keymaster
    (BuddyDev Team)
    Posts: 13067
    Brajesh Singh on #26944

    Hi,
    Sure.

    Translations allows you to translate the text from one language to another(localization). It is normally used to translate a software written one language to make it usable for other language users.

    Please find more details here
    https://developer.wordpress.org/plugins/internationalization/localization/
    https://premium.wpmudev.org/blog/ultimate-guide-wordpress-localization/

    or you can simply install POEdit and try opening the .po file there and translate. Once, It is translated, save the generated file as the name-en_US.mo(depending on plugin name/your current locale) and WordPress will pick it.

    You can later move the translaton to wp-content/languages/plugins/ directory.

    Regards
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 78
    JohnnyNW on #26949

    Oh yes, I see! Very scary at first LOL Thank you for the links!


  • Keymaster
    (BuddyDev Team)
    Posts: 13067
    Brajesh Singh on #26955

    🙂

You must be logged in to reply to this topic.

This topic is: resolved
Subscribe