Changeset 13442 for trunk/src/bp-messages/bp-messages-star.php
- Timestamp:
- 03/27/2023 06:19:06 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-star.php
r13433 r13442 114 114 ); 115 115 116 // Check user ID and determine base user URL. 117 switch ( $r['user_id'] ) { 118 119 // Current user. 120 case bp_loggedin_user_id() : 121 $user_domain = bp_loggedin_user_domain(); 122 break; 123 124 // Displayed user. 125 case bp_displayed_user_id() : 126 $user_domain = bp_displayed_user_domain(); 127 break; 128 129 // Empty or other. 130 default : 131 $user_domain = bp_members_get_user_url( $r['user_id'] ); 132 break; 133 } 116 // Check user ID and determine base user slug. 117 $user_slug = bp_members_get_user_slug( $r['user_id'] ); 134 118 135 119 // Bail if no user domain was calculated. 136 if ( empty( $user_ domain) ) {120 if ( empty( $user_slug ) ) { 137 121 return ''; 138 122 } 123 124 $message_slug = bp_get_messages_slug(); 125 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 126 $path_chunks = array( 127 'component_id' => 'members', 128 'single_item' => $user_slug, 129 'single_item_component' => $custom_message_slug, 130 ); 139 131 140 132 // Define local variables. … … 183 175 184 176 if ( true === $is_starred ) { 185 $action = 'unstar'; 186 $bulk_attr = ' data-star-bulk="1"'; 187 $retval = $user_domain . bp_get_messages_slug() . '/unstar/' . $message_id . '/' . $nonce . '/all/'; 177 $action = 'unstar'; 178 $bulk_attr = ' data-star-bulk="1"'; 179 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_unstar', 'unstar' ); 180 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce, bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_all', 'all' ) ); 188 181 } else { 189 $action = 'star'; 190 $retval = $user_domain . bp_get_messages_slug() . '/star/' . $message_id . '/' . $nonce . '/'; 182 $action = 'star'; 183 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_star', 'star' ); 184 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce ); 191 185 } 192 186 … … 200 194 201 195 if ( true === $is_starred ) { 202 $action = 'unstar'; 203 $retval = $user_domain . bp_get_messages_slug() . '/unstar/' . $message_id . '/' . $nonce . '/'; 196 $action = 'unstar'; 197 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_unstar', 'unstar' ); 198 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce ); 204 199 } else { 205 $action = 'star'; 206 $retval = $user_domain . bp_get_messages_slug() . '/star/' . $message_id . '/' . $nonce . '/'; 200 $action = 'star'; 201 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_star', 'star' ); 202 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce ); 207 203 } 208 204 209 205 $title = $r["title_{$action}"]; 210 206 } 207 208 $url = bp_rewrites_get_url( $path_chunks ); 211 209 212 210 /** … … 215 213 * @since 2.3.0 216 214 * 217 * @param string $ retval URL for starring / unstarring a message.218 * @param array $r 215 * @param string $url URL for starring / unstarring a message. 216 * @param array $r Parsed link arguments. See $args in bp_get_the_message_star_action_link(). 219 217 */ 220 $retval = esc_url( apply_filters( 'bp_get_the_message_star_action_urlonly', $ retval, $r ) );218 $retval = esc_url( apply_filters( 'bp_get_the_message_star_action_urlonly', $url, $r ) ); 221 219 if ( true === (bool) $r['url_only'] ) { 222 220 return $retval;
Note: See TracChangeset
for help on using the changeset viewer.