Making message read-only


Home Forums Front End PM PRO Making message read-only

This topic is: Resolved
Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #10488
    Alex Brearley
    Participant

    Is it possible to make a message thread read-only i.e. people can read the thread but can’t reply?

    #10499
    shamim
    Keymaster

    You want this for only one message or all messages?

    #10501
    Alex Brearley
    Participant

    one particular message – I have the parent message ID

    #10503
    shamim
    Keymaster

    Add following code in your theme’s (child theme’s if any) functions.php

    
    add_filter( 'fep_current_user_can', function( $can, $cap, $id ){
    	if( 'send_reply' == $cap && 123 == $id )
    	return false;
    	
    	return $can;
    }, 10, 3);
    

    Change 123 with your parent message id

    #10542
    Alex Brearley
    Participant

    Thank you

    #10673
    Alex Brearley
    Participant

    What would be best practice to hide a message entirely from a user so that they can no longer see the message thread in the inbox?

    #10683
    shamim
    Keymaster

    go to Front End PM PRO > All Messages and find that message and change status to anything else other that publish.

    #10777
    Alex Brearley
    Participant

    Is $id in the code snippet the parent/first post ID or is it the latest message post ID (won’t be parent ID if someone has replied)? What I’m looking to do is given a parent ID (the first message) make that message and all subsequent post ID’s read only.

    add_filter( ‘fep_current_user_can’, function( $can, $cap, $id ){
    if( ‘send_reply’ == $cap && 123 == $id )
    return false;

    return $can;
    }, 10, 3);

    #10805
    shamim
    Keymaster

    it will parent id (first message id of the thread).

    #10891
    Alex Brearley
    Participant

    I’m getting a PHP warning saying that I’m missing argument 2 and 3 in that filter hook. Are you sure there are 3 parameters?

    #10901
    shamim
    Keymaster

    which version of this plugin you are using?

    #10910
    Alex Brearley
    Participant

    v7.1

    #10913
    shamim
    Keymaster

    This has 3 arguments.
    Can you please give me exact code what you have added and where added?

    #11053
    Alex Brearley
    Participant
    This reply has been marked as private.
    #11056
    shamim
    Keymaster

    You have missed ‘send_reply’ part. Please add

    if( 'send_reply' !== $cap )
    return $can;
    

    after line 76

    also write 10 and 3 as integer (without single quote). You can see functions.php of this plugin for this hook, this hook is passing 3 arguments.

Viewing 15 posts - 1 through 15 (of 22 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.