function privatemsg_get_dynamic_url_prefix in Privatemsg 6.2
Returns the current dynamic url prefix.
Does replace %user with the uid.
Parameters
$uid: Use this uid instead of global $user.
Return value
The privatemsg url prefix for the current request.
15 calls to privatemsg_get_dynamic_url_prefix()
- phptemplate_privatemsg_list_field__count in ./
privatemsg.theme.inc - Theme the replies field.
- phptemplate_privatemsg_list_field__subject in ./
privatemsg.theme.inc - Theme the subject of the thread.
- pm_block_user_form in pm_block_user/
pm_block_user.pages.inc - @file User menu callbacks for pm_block_user.module.
- pm_block_user_privatemsg_message_view_alter in pm_block_user/
pm_block_user.module - Implements hook_privatemsg_message_view_alter().
- PrivatemsgEMailNotifyTestCase::verifyMail in pm_email_notify/
pm_email_notify.test - Verify a notification mail.
File
- ./
privatemsg.module, line 357 - Allows users to send private messages to other users.
Code
function privatemsg_get_dynamic_url_prefix($uid = NULL) {
global $user;
if (!$uid) {
$uid = $user->uid;
// If viewing the messages of a different user, use that uid.
$url_prefix = variable_get('privatemsg_url_prefix', 'messages');
$url_prefix_user_arg_position = array_search('%user', explode('/', $url_prefix));
if ($account = menu_get_object('user', $url_prefix_user_arg_position)) {
$uid = $account->uid;
}
}
return str_replace('%user', $uid, variable_get('privatemsg_url_prefix', 'messages'));
}