I made this post on another thread, but lots of people are still asking for it on other threads, so i'm giving this it's own thread, at least until the original plugin does this.
To fully control SMF information (including signature that everyone wishes so much ) purely from CB, this is what you do:
go to com_comprofiler/plugin/user/plug_smfcbplugin/smf_cb.php (this is the SMF-CB plugin that comes with JSMF, not one of brat's plugins), go to the function updateUser and add these lines just above the "return true" at the last line of the function so that the whole function looks like this:
Code:
function updateUser($data, $extras, $status) { global $_PLUGINS; global $jsmfConfig; global $_POST, $database; global $user; $jsmf = new jsmfFrontend();
Obviously, you will need to create these fields using CB's field manager: cb_personaltext, cb_gender, cb_birthdate, cb_website (note: cb_website must be of type "Web Address", and select "Hypertext and URL" at the bottom), cb_location, cb_icq, cb_aim, cb_yim, cb_msn, cb_signature, and cb_usertitle.
You should create these fields inside the "Forum Profile" tab created when you installed brat's forum profile plugin (or joomlahack's version of it). If don't see Forum Profile as a valid selection for Tab when you're creating the fields, this is what you need to do: go to your phpmyadmin (or whatever you use to edit mysql), go to jos_comprofiler_tabs, look for Forum Profile under title, and change the fields column to 1. (Note: for users who enable Nest Tabs under CB's configuration > User Profile, this will result in the Forum Profile tab appearing under the Profile tab!)
All the extra fields created should be UNrequired (to suit SMF's conditions), NOT shown in profile (since we're going to use brat's profile plugin to output the result), NOT required during registration (cus the way i hacked the plugin, it only works when users UPDATE their profile, NOT during registration), and of course Published.
Next, remember to go to JSMF's configuration and enable Redirect Profile Links so that SMF's profile will not be viewable through SMF itself.
I have also included an edited copy of brat's plugin's smf_profile.php and smf_profile.html.php (unzip first. it's not the full plugin) which you should probably replace the one you have now. All my edits were commented with "//Mike's hack" at the top so you can easily find where the changes were made.
What my hacks do is to hide the Forum Profile tab totally from users who are either not the owner or admin (I think this is sensible, but if you want forum profile to be viewable to everyone, simply edit a line that i've added. Search for the first "Mike's hack" in smf_profile.php), hide the forum profile and settings links from ALL non-admin (including profile owner), hide the "Sync avatar" button from ALL non-admin (including profile owner), re-position the avatar and Personal Text position, and show fields that are NOT empty only.
Remember to backup all files before doing anything! If you wish to change the layout, simply look for all the "Mike's hack"s. Some knowledge of php is required for that. If not, using the files "as is" will work too. This is a pretty "unelegant" hack (as my hacks mostly are ) since i use it for my own purpose only. Hope it helps
Regards, Mike
Logged
----- Owner of http://mike.simbunch.com Creator of ParaInvite, AJAX Sandbox, AJAX SMF Polls, Profile URL etc..
I just discovered that this hack will only work with smf_cb_plugin_2_0 found in the JSMF RC1 package. The change made in smf_cb_plugin_2_0_1 will trigger the hack before the profile is actually updated in CB, so the values remain unchanged. This means updating of SMF fields take precedence, whereas for the hack to work, updating CB fields must take precedence
Rgds, Mike
Logged
----- Owner of http://mike.simbunch.com Creator of ParaInvite, AJAX Sandbox, AJAX SMF Polls, Profile URL etc..
in 2.0.1 the change was made because of the ability of a user to change their username via CB. When they attempt to change their username in CB we try to correlate this change through several different methods and if they fail then we need to make sure CB fails. Because if CB succeeds and SMF fails then there is no way to correlate the users going forward and they are viewed as separate users. Basically you lose all SMF information for that user *and* a new SMF user is created for the new CB username.
Very, very, very bad. Suggested workaround is to disable the ability to change usernames. Or use the plugin as it is distributed.
Wow, thanks! I think i just got a much clearer picture of how CB plugins work
Anyway, i just added a new parameter to allow users to hide their email in their smf profile. Create another CB field cb_hideemail (radio button: Yes/No), and use the following function inside smf_cb.php
Code:
/** * Update smf_members with optional info (field names below): * personalText, gender, birthdate, websiteTitle, websiteUrl, * location, hideEmail, ICQ, AIM, YIM, MSN, * signature, and usertitle */ function updateAfterUser($data, $extras, $status) { global $_PLUGINS; global $jsmfConfig; global $_POST, $database; $jsmf = new jsmfFrontend(); $jsmfConfig = $jsmf->loadParams(); $sql = "SELECT * FROM #__comprofiler WHERE `id` = '".$data->id."'"; $database->setQuery($sql); $cbData = null; $database->loadObject( $cbData ); //Get webpage values if (!empty($cbData->cb_website)) { $website = explode("|*|", $cbData->cb_website); if (substr(htmlspecialchars($website[0], ENT_QUOTES),0,7) != "http://") $websiteUrl .= "http://"; $websiteUrl .= htmlspecialchars($website[0], ENT_QUOTES); $websiteTitle = ($website[1] != "") ? htmlspecialchars($website[1], ENT_QUOTES) : $websiteUrl; } //Get hideEmail value if ($cbData->cb_hideemail == "Yes") $hideEmail = '1'; else $hideEmail = '0';
This works like a charm... even with the current release of the bridge. I have one question though. How would one modify it so that it would update upon new user signup?
for some reason the hide email hack does not really accomplish to hide entirely as the email button is still shown in posts on the forum. is it supposed to be like that?
hide_email only controls the visibility of your email address when viewing a user's profile in SMF. A separate configuration is used to allow board members to email you, which is more than likely the email button you are seeing.
Joomla Hacks is a Joomla Components, Joomla Modules, Joomla Templates, & Joomla Mambots resource portal. None of the text or images in this public website may be copied without the expressed written consent of the authors. Copyright 2005 by JoomlaHacks.com. Powered by Joomla. All rights reserved.
Terms of Use