BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53300

    By the way. I tried to edit my post because I forgot the code blocks but it says you cannot create new topics??

    
    
    add_filter(‘bp_get_the_members_invitation_property_’,function ($property,$value) {
    if ($property == ‘date_modified’){
    $value= date(‘d.m.Y’,strtotime($value));
    }
    return $value;
    },10,2);
    
    
  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53290

    I tried to overwrite the message with this filter below but inside the your surrounding filter it is not working. I suppose because the $message variable is unknown by the surrounding filter. But how can I solve this?

    add_filter( ‘bp_user_can’, function ( $retval, $user_id, $capability, $site_id, $args ) {

    if ( ‘bp_members_send_invitation’ !== $capability ) {
    return $retval;
    }

    $count = BP_Invitation::get_total_count( array(
    ‘inviter_id’ => $user_id
    ) );

    $max_allowed = 2;// change it.

    if ( $count >= $max_allowed ) {
    $retval = false;

    // overwrite message
    add_filter(‘members_invitations_form_access_restricted’,’overwrite_message’);
    function overwrite_message ($message) {
    $message = ( ‘You have reached the limit of invitations.’);
    return $message;
    }

    }

    return $retval;

    }, 10, 5 );

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53287

    So is there any possibility to change the error message at least?

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53283
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53282

    Hi Brajesh,
    it works. Great! Thank you.

    Just two more questions on this.

    1. At the backend on the invitations table you can see that the date is saved under “date modified”. Is it possible to get this date and then add it to your function? To check if the count is more than the max_allowed FOR THE SAME DAY, then set $retval to false?

    2. After the limit is reached the message pops up saying “you dont have the rights to send invitations”.
    Am I able to manipulate this message saying something like “you have reached the daily limit on invitations! Try again later”?

    Regards
    Alex

    PS: I really wonder why nobody has this implemented over the last years. Looks like buddypress core development slows down, which is not good.

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53266

    Glad that you were able to fix it! Maybe I need it in the future again. 🙂

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53265

    Or alternatively add Recaptche to the form…?

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53199

    By the way I was using BP nouveau template pack. Because you were asking.

    • This reply was modified 1 month, 3 weeks ago by Alex.
  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53198

    Hello Brajesh,

    I made another test to reproduce the error. On localhost I didn’t have this error yet.

    Its the same procedure what I wrote above.
    Plugins activated: Your data control plugin (current version), bp classic and buddypress (both current version).
    Themes tested with: Astra and twenty twenty four.

    The name field is the only field on xfields section which you cannot delete. Make the changes at your plugin which I made the screenshot from (switch “who can edit” from Adminstrator to Subscriber).
    Then you get the warning. This time with debug on I got a more detailled warning. I also attach these image here. Hope this helps.

    This is all what I can do to help to fix that issue.

    Meanwhile I programmed my own plugin for my needs with the advantage that I know whats going on.

    So I don’t need this plugin anymore. If you want you can mark this thread as solved.

    https://postimg.cc/xXfFtdB5

    Error message
    https://postimg.cc/JDVF3Q8D

  • Participant
    Level: Enlightened
    Posts: 44
    Alex on #53195

    Hello Brajesh,
    could you give a short report that you are able to reproduce the warning and are working on a fix?
    Otherwise I need to look after other solutions like this one f.e.
    https://buddypress.org/support/topic/dont-allow-users-to-change-some-fields-after-sign-up-hide-those-fields/
    because I dont want, that subscripers can edit their username after registration.

    Thanks for giving a short update on this!