Exemple #1
0
function nm_invite_email($emails, $message)
{
    $user = wp_get_current_user();
    $subject = 'Join ' . nm_user_public_name($user->ID) . ' at ' . get_bloginfo() . '!';
    $emails = explode(',', $emails);
    $headers = "";
    $headers .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: admin@hotcars.com' . "\r\n";
    $headers .= 'Subject: ' . $subject . "\r\n";
    $email_message = '<html><head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Join me at ' . get_bloginfo() . '!</title></head>
		<body style="font-family:Verdana, Arial, Helvetica, sans-serif;color:#fff;font-size:13px;background:#000;color:#fff;">
		<!-- top -->
		<table cellspacing="0" cellpadding="0" border="0" align="center" style="border:#000 1px solid;padding:0;width:548px;">
		<tr>
			<td valign="top" style="width:358px;height:91px;padding:0 0 1px 0;background:#000;vertical-align:top;">
			<a href="' . get_bloginfo('wpurl') . '" style="text-decoration:none;margin:0;padding:0;"><img src="' . get_bloginfo('stylesheet_directory') . '/images/email/header1.jpg" width="358" height="91" border="0" style="margin:0;padding:0;" alt="' . get_bloginfo() . ' logo" /></a>
			</td>
			<td valign="top" style="width:190px;height:91px;padding:0 0 1px 0;background:#000;vertical-align:top;">
			<a href="' . get_bloginfo('wpurl') . '/forums/register.php" style="text-decoration:none;margin:0;padding:0;">
			<img src="' . get_bloginfo('stylesheet_directory') . '/images/email/header2.jpg" width="190" height="91" border="0" style="margin:0;padding:0;" alt="Login to ' . get_bloginfo('wpurl') . '" />
			</a>
			</td>
		</tr>
		<tr>
			<td colspan="2" valign="top" style="width:518px;padding:20px 15px 20px 15px;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:13px;background:#333;color:#fff;">
			<div style="font-size:16px;font-weight:bold;padding:0 0 6px 0;color:#fff;">Check out <a style="color:#fff;" href="' . get_bloginfo('wpurl') . '">' . get_bloginfo(wpurl) . '</a>!</div>
		 	<strong>' . nm_user_public_name($user->ID) . '</strong> has personally invited you to join ' . get_bloginfo() . ':<br /><br />
			<span style="padding-left:10px;"><em>' . $message . '</em></span><br /><br />
			<a style="color:#fff;" href="' . get_bloginfo('wpurl') . '/forums/register.php">Sign up today</a>!<br /><br />
			</td></tr></table></body></html>';
    for ($i = 0; $i < count($emails); $i++) {
        $emails[$i] = trim($emails[$i]);
        if (verify_email($emails[$i])) {
            global $wpdb;
            mail($emails[$i], $subject, $email_message, $headers);
            $errors = "<p class='message success'>Your Friend Invitations have been successfully sent!</p>";
        }
    }
    return $errors;
}
 function query_meta($fields)
 {
     $results = array();
     global $wpdb;
     if ($this->search_term) {
         $currentUser = wp_get_current_user();
         $query = "SELECT ID FROM {$wpdb->users} WHERE NOT ID = '{$currentUser->ID}'";
         $users = $wpdb->get_col($query);
         $search = $this->search_term;
         $fields = explode(',', $fields);
         foreach ($users as $user) {
             $userPublicName = nm_user_public_name($user);
             //Search the Meta
             foreach ($fields as $field) {
                 $field = trim($field);
                 $fieldData = nm_profile_info($field, $user);
                 if (!is_array($fieldData)) {
                     if (eregi($search, $fieldData)) {
                         $results[] = $user;
                     }
                 } elseif (is_array($fieldData)) {
                     foreach ($fieldData as $value) {
                         if (eregi($search, $value)) {
                             $results[] = $user;
                         }
                     }
                 }
             }
             //Search the Public Name
             if (eregi($search, $userPublicName)) {
                 $results[] = $user;
             }
         }
     }
     $this->user_meta_results = $results;
 }
Exemple #3
0
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
						 			<tr>
						 				<td width="30"></td>
						 				<td>
                	      					<a href="<?php 
    echo getProfileLink($userInfo->ID);
    ?>
"><img src="<?php 
    echo userPhoto($userInfo->ID);
    ?>
" class="photo"/></a>
                	     					<br /><span style="color:#000;">From:</span>  <a href="<?php 
    echo getProfileLink($userInfo->ID);
    ?>
" style="color:red"><?php 
    echo nm_user_public_name($userInfo->ID);
    ?>
</a><br />
						 					<span style="color:#000">Subject:</span> <?php 
    echo $message['subject'];
    ?>
<br />
						 					<br />
						 					<p class="blogContent"><?php 
    echo $message['message'];
    ?>
</p>
											<br />
											<b>Recieved at <?php 
    echo date('g:i A', $message['date']);
    ?>
Exemple #4
0
function nm_unsubscribe_to_blog($authorID, $userID = false)
{
    if ($userID == false) {
        $userInfo = wp_get_current_user();
    } else {
        $userInfo = get_userdata($userID);
    }
    $authordata = get_userdata($authorID);
    // Ger usermeta for users
    $user_meta = get_usermeta($userInfo->ID, 'blog_subscriptions');
    $author_meta = get_usermeta($authordata->ID, 'blog_readers');
    //Remove the respective subsciptions
    unset($user_meta[$authordata->ID]);
    unset($author_meta[$userInfo->ID]);
    //Send the new data back to the database
    update_usermeta($userInfo->ID, 'blog_subscriptions', $user_meta);
    update_usermeta($authordata->ID, 'blog_readers', $author_meta);
    return '<p class="message success">You have successfuly unsubscribed to ' . nm_user_public_name($authordata->ID) . '\'s blog</p>';
}
Exemple #5
0
</b></a><br/>
                    <span class="Spec">
                        Added: <span class="SpecSource"><?php 
        the_time('jS F');
        ?>
</span><br/>
                    </span>
                <span class="Spec">
                    From:
                    <span class="SpecSource">
                        <a href="<?php 
        echo getProfileLink($post->post_author);
        ?>
">
                            <?php 
        echo nm_user_public_name($post->post_author);
        ?>
                        </a>
                    </span>
                </span>
                <img src="<?php 
        bloginfo('stylesheet_directory');
        ?>
/images/common/rating-<?php 
        echo nm_get_photo_rating($post->ID);
        ?>
-stars.gif" alt="review rating"/>
            </div>
            <?php 
    }
} else {
Exemple #6
0
/**
 * Alerts your friends when you leave a group
 *
 * @author: Tom Willmot
 * @version 1.0
 **/
function nm_alert_friend_left_group($group)
{
    $userInfo = wp_get_current_user();
    $userInfo = get_userdata($userInfo->ID);
    global $group;
    $group = $group;
    $post = get_post($group);
    $friendList = new userFriends();
    $friends = $friendList->get_friends($userInfo->ID);
    if ($friends) {
        $friends = array_flip($friends);
        $alert = array();
        $alert['content'] = '<a href="' . getProfileLink($userInfo->ID) . '" title="View ' . nm_user_public_name($userInfo) . 's profile">' . nm_user_public_name($userInfo) . '</a> has left the <a href="' . nm_group_permalink() . '" title="View the ' . $post->post_title . '">' . $post->post_title . '</a> Group.';
        $alert['type'] = 'group';
        nm_add_alert($friends, $alert);
    }
}
Exemple #7
0
/**
 * Send private message to specified user
 *
 * @Param: Recipient ID ($recipient)
 * @Param: Subject ($subject)
 * @Param: Message ($message)
 * @Param: Sender ID ($sender) [optional]
 * @return: Feedback (string)
 * @author: Joe Hoyle
 * @version 1.0
 **/
function nm_send_message($recipient, $subject, $message, $sender = false)
{
    // Get userdata from IDs supplied
    if ($sender == false) {
        $sender = wp_get_current_user();
    } else {
        $sender = get_userdata($sender);
    }
    $recipient = get_userdata($recipient);
    //Perform error checking on data
    if (!$sender) {
        $feedback = 'Invalid sender specified';
    } elseif (!$recipient) {
        $feedback = 'Invalid recipient specified';
    } elseif ($subject == '') {
        $feedback = 'Please enter a subject';
    } elseif ($message == '') {
        $feedback = 'Please enter a message';
    } else {
        // Ger usermeta for each user
        $recipient_meta = get_usermeta($recipient->ID, 'received_messages');
        $sender_meta = get_usermeta($sender->ID, 'sent_messages');
        //Compile message data into respective array
        $recmessage = array();
        $recmessage['subject'] = $subject;
        $recmessage['message'] = $message;
        $recmessage['from'] = $sender->ID;
        $recmessage['date'] = time();
        $recmessage['read'] = "false";
        $recmessage['type'] = "private";
        $sentMessage = array();
        $sentMessage['subject'] = $recmessage['subject'];
        $sentMessage['message'] = $recmessage['message'];
        $sentMessage['to'] = $recipient->ID;
        $sentMessage['date'] = $recmessage['date'];
        $sentMessage['read'] = $recmessage['read'];
        $sentMessage['type'] = $recmessage['type'];
        // If the user's meta is empty then create the arrays
        if (!is_array($recipient_meta)) {
            $recipient_meta = array();
        }
        if (!is_array($sender_meta)) {
            $sender_meta = array();
        }
        //Push the new message arrays to the front of the user's meta
        array_push($recipient_meta, $recmessage);
        array_push($sender_meta, $sentMessage);
        //Send the user's meta back to the database
        update_usermeta($recipient->ID, 'received_messages', $recipient_meta);
        update_usermeta($sender->ID, 'sent_messages', $sender_meta);
        //Return successfull feedback
        $feedback = 'Message successfully sent to ' . nm_user_public_name($recipient->ID);
        $success = true;
    }
    //Return $feedback
    if ($success == true) {
        return '<p class="message success">' . $feedback . '</p>';
    } else {
        return '<p class="message error">' . $feedback . '</p>';
    }
}