David

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 110 total)
  • Author
    Posts
  • in reply to: Message Query by Meta Key #45094
    David
    Participant

    Ok, thanks very much for your help.

    in reply to: Message Query by Meta Key #45079
    David
    Participant

    Hi Shamim,

    Thanks very much. The meta query is working but I am also trying to orderby the meta value. I have tried everything I can think of but it won’t work. This is what I have:


    add_filter( 'fep_message_query_args', 'totalsortjg');
    function totalsortjg( $args ) {
    if (in_array('subscriber', wp_get_current_user()->roles) && isset($_GET['partotal'])) {
    $args['meta_query'][] = ['totalsort' => [
    'key' => 'total_sort',
    'value' => 1,
    'compare' => '>',
    'type' => 'NUMERIC'
    ]];
    $args['orderby'] = ['totalsort' => 'DESC'];
    }
    return $args;
    }

    Thanks for the help.

    in reply to: Message Query by Meta Key #45058
    David
    Participant

    Ok, I have tried this and the meta_key is definitely there but the following code is not doing anything:


    add_filter( 'fep_message_query_args', 'totalsortjg');
    function totalsortjg( $args ) {
    if (in_array('subscriber', wp_get_current_user()->roles) && isset($_GET['partotal'])) {
    $args['meta_key'] = 'total_sort';
    }
    return $args;
    }

    I am expecting to only see messages with the meta_key present. Any help is appreciated.

    in reply to: Message Query by Meta Key #45056
    David
    Participant

    Ok, I think I have figured this out! I thought it was using the parent message which is the one with the meta_key but of course it is not the parent, it is the child message that is being queried and these do not have the meta keys. I will have to rethink this.

    in reply to: Message Query by Meta Key #45054
    David
    Participant

    I have also tried this but I just cannot make it work.


    add_filter( 'fep_message_query_args', function( $args, $user_id ) {
    if (in_array('subscriber', wp_get_current_user()->roles) && isset($_GET['partotal'])) {
    unset( $args['orderby'], $args['meta_key'], $args['order'] );
    $args['meta_key'] = 'parent_total';
    $args['orderby'] = 'meta_value_num';
    $args['order'] = 'DESC';
    return $args;
    } else {
    return $args;
    }
    }, 10, 2 );

    in reply to: Message Query by Meta Key #45047
    David
    Participant

    No, thought I had figured it out but still not working. I just want to query the messagebox by a meta key and then orderby that meta key number. Any help is appreciated.

    in reply to: Message Query by Meta Key #45045
    David
    Participant

    Sorry, figured it out. Answer for anyone needing it in the future:


    add_filter( 'fep_message_query_args', function( $args, $user_id ) {
    if (in_array('subscriber', wp_get_current_user()->roles) && isset($_GET['partotal'])) {
    $args = array(
    'meta_query' => array(
    array(
    'key' => 'parent_currency',
    'value' => 'LKR',
    'compare' => '=',
    ),
    ),
    'orderby' => 'meta_value',
    'order' => 'DESC'
    );
    $args['participant_query'][] = array(
    'mgs_participant' => $user_id);
    return $args;
    } else {
    return $args;
    }
    }, 10, 2 );

    in reply to: Dynamic Update Message View #44687
    David
    Participant

    Yes, I can probably manage the error message myself with my limited skills. I was thinking though that it could be a useful addition to the core plugin. I am not sure the thread needs to dynamically update, maybe just a link in the error message which refreshes the page would work ok.

    in reply to: What format to use with ‘created_before’ => #44601
    David
    Participant

    Great thanks very much for your quick reply.

    in reply to: What format to use with ‘created_before’ => #44596
    David
    Participant

    Just to add that I am trying to achieve something like this:

    ‘created_before’ => ‘1 year ago’

    like I would do in a date_query.

    in reply to: Problems with Additional Form Fields #43895
    David
    Participant

    Hi Shamim,

    I am using this code now for the shortcode-newmessage. However, I would like to make it specific to the page or post that I am on. This is because I am using the shortcode in three different places and I only want to redirect from one of those. Is it possible? I tried adding “is_page(‘test’) but it didn’t work.

    Thanks for any help.

    in reply to: Add Delete Button on View Message Page? #43891
    David
    Participant

    Ok figured it out. Full code is here if it helps anyone in the future:

    if ( isset($_GET['id']) && (isset($_GET['your_action']) == 'delete')) {
    $id = $_GET['id'];
    if ( $id && in_array( get_current_user_id(), fep_get_participants( $id, true ) ) && fep_get_message_status( $id ) == 'publish' ) {
    fep_delete_message($_GET['id']);
    delete_user_option( get_current_user_id(), '_fep_user_message_count',true );
    }
    }

    in reply to: Add Delete Button on View Message Page? #43886
    David
    Participant

    Hi Shamim,

    I have managed to do achieve this but one problem is that fep_get_user_message_count( “total” ) is sometimes not updating after the message is deleted.

    Can I update this value somehow? It works ok when I delete a message normally but I can’t see any difference.

    Thanks for any help.

    in reply to: Notification emails using fep_send_message function #43778
    David
    Participant

    The plugin is Calculated Fields Form. The code fires immediately after a form is submitted. After that is complete there is a redirect to another page. I do not know anymore than this without asking the plugin authors. I do have an option to use the form submitted email to send the notification instead now that I know the normal fep notification is not going. Thanks for the clarification.

    in reply to: Notification emails using fep_send_message function #43773
    David
    Participant

    Hi Shamim,

    Thanks for your quick reply.

    I can confirm that if I use your code in functions.php it works fine and the notification email is sent.

    However, I am using it a bit differently. I am using it in relation to another plugin. The code is as follows:

    if($params['formid'] == 69) {

    if ( get_current_user_id() < 1 )
    return;
    if ( ! function_exists( 'fep_send_message' ) )
    return;

    // Prepare message data
    $message = array(
    'message_title' => 'New Enquiry', //change with message title
    'message_content' => $params['fieldname42'], //change with message content
    'message_to_id' => 8037
    );

    $override = array(
    'mgs_author' => get_current_user_id(), //change with message sender id
    );

    // Send message
    fep_send_message( $message, $override );

    }

    When I submit the form on the other plugin the message sends ok but the notification email does not send. I have checked the email log and nothing is sending.

    Can I use it like this? I cannot really see why it does not work.

    Thanks for any further help..

Viewing 15 posts - 1 through 15 (of 110 total)