<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[BuddyPress] [1891] trunk:
  Fixing profile pages to work when xprofile is disabled.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>1891</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-16 21:23:40 +0000 (Wed, 16 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixing profile pages to work when xprofile is disabled. Added more extensive options to groups_invite_user().</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpgroupsdeprecatedbpgroupsdeprecatedphp">trunk/bp-groups/deprecated/bp-groups-deprecated.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpthemesbpdefault_inccssscreencss">trunk/bp-themes/bp-default/_inc/css/screen.css</a></li>
<li><a href="#trunkbpthemesbpsnparent_incajaxphp">trunk/bp-themes/bp-sn-parent/_inc/ajax.php</a></li>
<li><a href="#trunkbpthemesbpsnparentprofileindexphp">trunk/bp-themes/bp-sn-parent/profile/index.php</a></li>
<li><a href="#trunkbpwirephp">trunk/bp-wire.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-activity.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -225,15 +225,15 @@
</span><span class="cx">         global $bp, $wpdb;
</span><span class="cx">         
</span><span class="cx">         $defaults = array(
</span><del>-                'user_id' =&gt; $bp-&gt;loggedin_user-&gt;id,
-                'content' =&gt; false,
-                'primary_link' =&gt; false,
-                'component_name' =&gt; false,
-                'component_action' =&gt; false,
-                'item_id' =&gt; false,
-                'secondary_item_id' =&gt; false,
-                'recorded_time' =&gt; time(),
-                'hide_sitewide' =&gt; false
</del><ins>+                'user_id' =&gt; $bp-&gt;loggedin_user-&gt;id, // The user to record the activity for
+                'content' =&gt; false, // The content of the activity item
+                'primary_link' =&gt; false, // The primary URL for this item in RSS feeds
+                'component_name' =&gt; false, // The name/ID of the component e.g. groups, profile, mycomponent
+                'component_action' =&gt; false, // The component action e.g. new_wire_post, profile_updated
+                'item_id' =&gt; false, // Optional: The ID of the specific item being recorded, e.g. a blog_id, or wire_post_id
+                'secondary_item_id' =&gt; false, // Optional: A second ID used to further filter e.g. a comment_id
+                'recorded_time' =&gt; time(), // The time that this activity was recorded
+                'hide_sitewide' =&gt; false // Should this be hidden on the sitewide activity stream?
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-core.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -324,22 +324,35 @@
</span><span class="cx"> function bp_core_setup_nav() {
</span><span class="cx">         global $bp;
</span><span class="cx">         
</span><del>-        if ( !function_exists('xprofile_install') ) {
</del><ins>+        /*** 
+         * If the extended profiles component is disabled, we need to revert to using the
+         * built in WordPress profile information
+         */
+        if ( !function_exists( 'xprofile_install' ) ) {
+                /* Fallback wire values if xprofile is disabled */
+                $bp-&gt;core-&gt;profile-&gt;slug = 'profile';
+                $bp-&gt;active_components[$bp-&gt;core-&gt;profile-&gt;slug] = $bp-&gt;core-&gt;profile-&gt;slug;
+
</ins><span class="cx">                 /* Add 'Profile' to the main navigation */
</span><del>-                bp_core_add_nav_item( __('Profile', 'buddypress'), 'profile' );
-                bp_core_add_nav_default( 'profile', 'bp_core_catch_profile_uri', 'public' );
</del><ins>+                bp_core_new_nav_item( array( 
+                        'name' =&gt; __('Profile', 'buddypress'),
+                        'slug' =&gt; $bp-&gt;core-&gt;profile-&gt;slug,
+                        'position' =&gt; 20,
+                        'screen_function' =&gt; 'bp_core_catch_profile_uri',
+                        'default_subnav_slug' =&gt; 'public'
+                ) );
</ins><span class="cx"> 
</span><span class="cx">                 $profile_link = $bp-&gt;loggedin_user-&gt;domain . '/profile/';
</span><del>-
</del><ins>+                
</ins><span class="cx">                 /* Add the subnav items to the profile */
</span><span class="cx">                 bp_core_new_subnav_item( array(
</span><span class="cx">                         'name' =&gt; __( 'Public', 'buddypress' ),
</span><span class="cx">                         'slug' =&gt; 'public',
</span><span class="cx">                         'parent_url' =&gt; $profile_link,
</span><del>-                        'parent_slug' =&gt; 'profile',
-                        'screen_function' =&gt; 'xprofile_screen_display_profile',
-                        'position' =&gt; 10
</del><ins>+                        'parent_slug' =&gt; $bp-&gt;core-&gt;profile-&gt;slug,
+                        'screen_function' =&gt; 'bp_core_catch_profile_uri'
</ins><span class="cx">                 ) );
</span><ins>+                
</ins><span class="cx"> 
</span><span class="cx">                 if ( 'profile' == $bp-&gt;current_component ) {
</span><span class="cx">                         if ( bp_is_home() ) {
</span></span></pre></div>
<a id="trunkbpgroupsdeprecatedbpgroupsdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/deprecated/bp-groups-deprecated.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/deprecated/bp-groups-deprecated.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-groups/deprecated/bp-groups-deprecated.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -635,7 +635,7 @@
</span><span class="cx">         
</span><span class="cx">         if ( 'invite' == $_POST['friend_action'] ) {
</span><span class="cx">                                 
</span><del>-                if ( !groups_invite_user( $_POST['friend_id'], $_POST['group_id'] ) )
</del><ins>+                if ( !groups_invite_user( array( 'user_id' =&gt; $_POST['friend_id'], 'group_id' =&gt; $_POST['group_id'] ) ) )
</ins><span class="cx">                         return false;
</span><span class="cx">                 
</span><span class="cx">                 $user = new BP_Core_User( $_POST['friend_id'] );
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-groups.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -2210,28 +2210,42 @@
</span><span class="cx">         return BP_Groups_Member::get_invites( $user_id );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function groups_invite_user( $user_id, $group_id ) {
</del><ins>+function groups_invite_user( $args = '' ) {
</ins><span class="cx">         global $bp;
</span><span class="cx">         
</span><ins>+        $defaults = array(
+                'user_id' =&gt; false,
+                'group_id' =&gt; false,
+                'inviter_id' =&gt; $bp-&gt;loggedin_user-&gt;id,
+                'date_modified' =&gt; time(),
+                'is_confirmed' =&gt; 0
+        );
+
+        $args = wp_parse_args( $args, $defaults );
+        extract( $args, EXTR_SKIP );        
+
+        if ( !$user_id || !$group_id )
+                return false;
+        
</ins><span class="cx">         if ( groups_is_user_member( $user_id, $group_id ) )
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><span class="cx">         $invite = new BP_Groups_Member;
</span><span class="cx">         $invite-&gt;group_id = $group_id;
</span><span class="cx">         $invite-&gt;user_id = $user_id;
</span><del>-        $invite-&gt;date_modified = time();
-        $invite-&gt;inviter_id = $bp-&gt;loggedin_user-&gt;id;
-        $invite-&gt;is_confirmed = 0;
</del><ins>+        $invite-&gt;date_modified = $date_modified;
+        $invite-&gt;inviter_id = $inviter_id;
+        $invite-&gt;is_confirmed = $is_confirmed;
</ins><span class="cx">         
</span><span class="cx">         if ( !$invite-&gt;save() )
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><del>-        do_action( 'groups_invite_user', $group_id, $user_id );
</del><ins>+        do_action( 'groups_invite_user', $args );
</ins><span class="cx">                 
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function groups_uninvite_user( $user_id, $group_id, $deprecated = true ) {
</del><ins>+function groups_uninvite_user( $user_id, $group_id ) {
</ins><span class="cx">         global $bp;
</span><span class="cx">         
</span><span class="cx">         if ( !BP_Groups_Member::delete( $user_id, $group_id ) )
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_inccssscreencss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/screen.css (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/screen.css        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-themes/bp-default/_inc/css/screen.css        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -1971,11 +1971,11 @@
</span><span class="cx"> 
</span><span class="cx"> /**** PROFILES ************************/
</span><span class="cx"> 
</span><del>-table.profile-fields tr.alt {
</del><ins>+table.profile-fields tr.alt, table.wp-profile-fields tr.alt {
</ins><span class="cx">         background: #f0f0f0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-table.profile-fields tr td.label {
</del><ins>+table.profile-fields tr td.label, table.wp-profile-fields tr td.label {
</ins><span class="cx">         border-right: 1px solid #dadada;
</span><span class="cx">         font-weight: bold;
</span><span class="cx"> }
</span><span class="lines">@@ -1984,14 +1984,14 @@
</span><span class="cx">         margin: 0.2em 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-table.profile-fields {
</del><ins>+table.profile-fields, table.wp-profile-fields {
</ins><span class="cx">         width: 100%;
</span><span class="cx"> }
</span><del>-        table.profile-fields tr td {
</del><ins>+        table.profile-fields tr td, table.wp-profile-fields tr td {
</ins><span class="cx">                 padding: 0.5em 1em;
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        table.profile-fields tr td.label {
</del><ins>+        table.profile-fields tr td.label, table.wp-profile-fields tr td.label {
</ins><span class="cx">                 width: 130px;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpsnparent_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-sn-parent/_inc/ajax.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-sn-parent/_inc/ajax.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-themes/bp-sn-parent/_inc/ajax.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">         
</span><span class="cx">         if ( 'invite' == $_POST['friend_action'] ) {
</span><span class="cx">                                 
</span><del>-                if ( !groups_invite_user( $_POST['friend_id'], $_POST['group_id'] ) )
</del><ins>+                if ( !groups_invite_user( array( 'user_id' =&gt; $_POST['friend_id'], 'group_id' =&gt; $_POST['group_id'] ) ) )
</ins><span class="cx">                         return false;
</span><span class="cx">                 
</span><span class="cx">                 $user = new BP_Core_User( $_POST['friend_id'] );
</span></span></pre></div>
<a id="trunkbpthemesbpsnparentprofileindexphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-sn-parent/profile/index.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-sn-parent/profile/index.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-themes/bp-sn-parent/profile/index.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx">                         &lt;?php do_action( 'bp_before_profile_wire_loop' ); /* Deprecated -&gt; */ do_action( 'bp_custom_profile_boxes' ) ?&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php /* Profile Wire Loop - uses [TEMPLATEPATH]/wire/post-list.php */ ?&gt;
</span><del>-                        &lt;?php if ( function_exists('bp_wire_get_post_list') ) : ?&gt;
</del><ins>+                        &lt;?php if ( function_exists('bp_wire_get_post_list') &amp;&amp; function_exists( 'xprofile_install' ) ) : ?&gt;
</ins><span class="cx"> 
</span><span class="cx">                                 &lt;?php do_action( 'bp_before_profile_wire_widget' ) ?&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpwirephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-wire.php (1890 => 1891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-wire.php        2009-09-16 20:05:36 UTC (rev 1890)
+++ trunk/bp-wire.php        2009-09-16 21:23:40 UTC (rev 1891)
</span><span class="lines">@@ -33,6 +33,10 @@
</span><span class="cx"> function bp_wire_setup_nav() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><ins>+        /* Profile wire's will only work if xprofile is enabled */
+        if ( !function_exists( 'xprofile_install' ) )
+                return false;
+                
</ins><span class="cx">         /* Add 'Wire' to the main navigation */
</span><span class="cx">         bp_core_new_nav_item( array( 'name' =&gt; __('Wire', 'buddypress'), 'slug' =&gt; $bp-&gt;wire-&gt;slug, 'position' =&gt; 40, 'screen_function' =&gt; 'bp_wire_screen_latest', 'default_subnav_slug' =&gt; 'all-posts', 'item_css_id' =&gt; $bp-&gt;wire-&gt;id ) );
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>