PaulMRivera
Forum Replies Created
-
So I’ve run into a problem (not sure if it’s to do with an update of some sort or maybe i just didn’t notice it). The code above still works by blocking a user to send a private message if their credits are zero.
What’s happening now though is that if Person A has 1 credit and sends a message to Person B it will set the credits to 0 for person A and start the conversation, but since the credits are 0 for Person A, Person A can’t send a reply message in that same conversation. If the conversation is started and Person A has 1 or more credits, Person A can reply as much as they want within that conversation without being deducted a credit.
I know the problem is related to:
$mycred_message_blocked = false; if ( $balance == 0 ) { $message->recipients = array(); $mycred_message_blocked = true; }
Is there a way to modify this code so that if Person A has 0 credits they can still reply within private messages (conversations) already initiated?
got it. Pay day is Wednesday ??
Success! Thank you so much for helping me out. Do you have a donation page? This plugin is exactly what I needed, and I always want to help developers out.
Could it be that since we are removing the recipient to get the error that it’s pulling the recipient error rather than the “no balance” error? Something like “if recipient=false then get error message” (sorry I’m not great at this php stuff)
I’ve seen a lot of places that to call a message would be
bp_core_add_message( __( 'Your message was sent successfully', 'buddypress' ) ); } else { bp_core_add_message( __( 'you're message was not sent', 'buddypress' ), 'error' ); }
k, I will keep trying. Thanks for your all your help
I did find this in my theme. possibly something with this?
<?php do_action( 'bp_before_notices_loop' ); ?> <?php if ( bp_has_message_threads() ) : ?> <div class="pagination no-ajax" id="user-pag"> <div class="pag-count" id="messages-dir-count"> <?php bp_messages_pagination_count(); ?> </div> <div class="pagination-links" id="messages-dir-pag"> <?php bp_messages_pagination(); ?> </div> </div><!-- .pagination --> <?php do_action( 'bp_after_notices_pagination' ); ?> <?php do_action( 'bp_before_notices' ); ?> <table id="message-threads" class="messages-notices"> <?php while ( bp_message_threads() ) : bp_message_thread(); ?> <tr id="notice-<?php bp_message_notice_id(); ?>" class="<?php bp_message_css_class(); ?>"> <td width="1%"></td> <td width="38%"> <strong><?php bp_message_notice_subject(); ?></strong> <?php bp_message_notice_text(); ?> </td> <td width="21%"> <?php if ( bp_messages_is_active_notice() ) : ?> <strong><?php bp_messages_is_active_notice(); ?></strong> <?php endif; ?> <span class="activity"><?php _e( 'Sent:', 'buddypress' ); ?> <?php bp_message_notice_post_date(); ?></span> </td> <?php do_action( 'bp_notices_list_item' ); ?> <td width="20%"> <a class="button tiny" href="<?php bp_message_activate_deactivate_link(); ?>" class="confirm"><?php bp_message_activate_deactivate_text(); ?></a> <a class="button tiny" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" title="<?php _e( "Delete Message", "buddypress" ); ?>">x</a> </td> </tr> <?php endwhile; ?> </table><!-- #message-threads --> <?php do_action( 'bp_after_notices' ); ?> <?php else: ?> <div id="message" class="info"> <p><?php _e( 'Sorry, no notices were found.', 'buddypress' ); ?></p> </div> <?php endif;?> <?php do_action( 'bp_after_notices_loop' ); ?>
still doesn’t work
I found the issue. Thanks for your help.
there was this in my theme
.fixed { position: fixed; }
that “add_message” function doesn’t work but i did find the following in the bp_core file. I believe this tells how to do it, I’m just not sure what to add.
/** * Checks if there is a feedback message in the WP cookie, if so, adds a * "template_notices" action so that the message can be parsed into the template * and displayed to the user. * * After the message is displayed, it removes the message vars from the cookie * so that the message is not shown to the user multiple times. * * @package BuddyPress Core * @global $bp_message The message text * @global $bp_message_type The type of message (error/success) * @uses setcookie() Sets a cookie value for the user. */ function bp_core_setup_message() { global $bp; if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) ) $bp->template_message = stripslashes( $_COOKIE['bp-message'] ); if ( empty( $bp->template_message_type ) && isset( $_COOKIE['bp-message-type'] ) ) $bp->template_message_type = stripslashes( $_COOKIE['bp-message-type'] ); add_action( 'template_notices', 'bp_core_render_message' ); if ( isset( $_COOKIE['bp-message'] ) ) @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH ); if ( isset( $_COOKIE['bp-message-type'] ) ) @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH ); } add_action( 'bp_actions', 'bp_core_setup_message', 5 ); /** * Renders a feedback message (either error or success message) to the theme template. * The hook action 'template_notices' is used to call this function, it is not called directly. * * @package BuddyPress Core * @global BuddyPress $bp The one true BuddyPress instance */ function bp_core_render_message() { global $bp; if ( !empty( $bp->template_message ) ) : $type = ( 'success' == $bp->template_message_type ) ? 'updated' : 'error'; $content = apply_filters( 'bp_core_render_message_content', $bp->template_message, $type ); ?> <div id="message" class="bp-template-notice <?php echo $type; ?>"> <?php echo $content; ?> </div> <?php do_action( 'bp_core_render_message' ); endif; }
trying to find this TABLE element in my CSS. I’ll keep you posted.
got it. thanks.
For some reason the history is a table that’s sticky to the header. It scrolls with the page. Do you have an email I can send a screenshot to?
resolved
it worked flawlessly! You are great. Thank you.
wow you are freaking amazing. I’ll test it out. thank you so much