How to make checkbox show for some user roles but not others and not loose its v


Home Forums Front End PM PRO How to make checkbox show for some user roles but not others and not loose its v

This topic is: Resolved

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18835
    ADM
    Participant

    Hi I’m pretty stuck so any help would be awesome. I edited the plugin and got it almost exactly as I need it except for the input checkboxes with a value. I need the checkboxes to appear for only the user that is allowed to ‘send-new-message’. For the rest of the plugin I managed to work it out by coding like this around the element:

    <?php
    if ( fep_current_user_can( ‘send_new_message’ ) ) {
    echo ‘<div class=”fep-bulk-action”>’;
    }
    ?>
    but this is in the ‘template’ file of the plugin and it worked perfectly.

    The check box code that’s giving me trouble is in ‘includes’ heres the code (including a the break and case just to give context):

    break;
    case ‘fep-cb’:
    ?>
    <input type=”checkbox” class=”fep-cb” name=”fep-message-cb[]” value=”<?php echo fep_get_the_id(); ?>” />
    <?php

    break;
    case ‘author’:
    how do I add:

    if ( fep_current_user_can( ‘send_new_message’ ) ) {
    echo
    without losing the ‘value’ or the functionality of the checkboxes?

    see attached for how it looks now. the ‘what subscriber sees’ screenshot is what where I want those checkboxes to the left to be removed

    Thanks for your time

    Attachments:
    You must be logged in to view attached files.
    #18875
    Shamim Hasan
    Keymaster

    Which version you are using? It is recommended always use latest version.
    You can use hooks to change almost anything of this plugin, so that you will not lose any changes when you update this plugin.

    To change checkbox output you can add following code in your theme’s functions.php

    add_action( 'fep_message_table_column_content_fep-cb', function(){
        if ( fep_current_user_can( 'send_new_message' ) ) {
            ?><input type="checkbox" class="fep-cb" name="fep-message-cb[]" value="<?php echo fep_get_the_id(); ?>" /><?php
        }
    });
    
    #18915
    ADM
    Participant

    worked thanks!!

Viewing 3 posts - 1 through 3 (of 3 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.