Forum Replies Created
-
In reply to: Extending BuddyPress with HTML5
yep, 10% IE6 is about all I’m getting on all my personal sites, so I stopped going out of the way to cater for it. so, time to start pushing the envelope a little bit maybe? as of yet, i’m still undecided, so for now i’ll stay put…
In reply to: [Poll] Which development tools do you useWhatever gets you going, Andrea
In reply to: [Poll] Which development tools do you useFirefox with Firebug,
NetBeans,
Photoshop,
Illustrator,
XAMPP,
TortoiseSVN,
FileZilla,
phpMyAdmin,
PoEdit,
iTunes,
coffee machine (should probably be no 1)…
In reply to: GPL Question re upcoming plugin releaseThe whole point of the GPL is that the code will always be available, even if the developer has given up on it. A more restrictive license might mean that people will not improve on what you have worked on and that your code might just go dormant.
If someone takes your code, improves it a bit and then sells it, the improved code will still have to be GPL. This means that you could then take all the changes made and incorporate it back into your plugin. You wouldn’t even have to buy the improved plugin, just get the code from somewhere. Or just reproduce any new features.
In reply to: GPL Question re upcoming plugin releaseGPL has nothing to do with code being free (as in beer). Anyone can take code published under the GPL (WordPress for example) and start charging for it as long as all necessary conditions are met.
In reply to: FirebugJust comment it out. If it’s within php tags then add
//just after the opening tag. If you want to hide multi-line php code then wrap whatever you want to hide like this:/* hide this sentence */If it’s html you want to hide then use this:
<!-- hide this sentence -->.You could always hire someone if this feature is critical for your project.
In reply to: Multiple user types – possible?I s’pose you’re talking about the 20 minutes I said it took me to code the bits with the registration in my earlier comment? Why’s that worrisome? It just shows how fast you can get results with BP. Would you rather work with a piece of software where you’d need three times as long for something as simple as what I did? Then, may I suggest Joomla?
You keep saying you’re not interested in programming and don’t really know it. That basically means you talk an aweful lot about things you really don’t know that much about…
In reply to: Multiple user types – possible?Bowe, I’d store user types as usermeta. Might be a bit more work code-wise, but I think more flexible.
Showing certain profile fields by user-type with jQuery is just your basic conditional stuff. If this user-type is selected, then show these fields, if another type is selected show some other fields.
In reply to: Multiple user types – possible?You can just add to the existing registration process via the available hooks. So basically you add a dropdown field where the user has to select an option. Then you use a bit of jQueryness to display the various profile fields you want that user-type to fill in. I’ve done something similar for group types. Took about 20 minutes to code, so it’s not really hard
In reply to: 1.1.3 or 1.2?Well, I’d say, get the latest trunk and start to code as much of the custom stuff as you can or get a developer to do it. As for themes, just pick one available right now (or just start from the new default one) and start to make it look the way you want it, do the wireframes, design, images, javascript and the css and you’ll be up and running in no time once 1.2’s out the door.
Keep a close look at what changes go into the trunk and update your theme once every couple days.
Andy said himself that after 1.2 there won’t be that many template changes…
In reply to: Single WP supported on latest trunkI installed BP on a single install of WP a few days ago and it worked pretty well, except for a few smaller problems. The profile field setup menu item didn’t show up, which turned out to be a wrongly named permission (so nothing to do actually with single WP) and for some reason the forums tables didn’t get installed at all, so I just imported them from a WPMU-BP install. All seems to work fine now…
From what I’ve heard you won’t even notice. There will then be an option that activates the multiuser part and that’s it.
You don’t have to use an unordered list for your widgets. You can use whatever you want. It says so as well later on in that obnoxious codex article.
In reply to: Move profile fields to another field group?Just had a quick look. You might be able to just get away with changing the group_id field in wp_bp_xprofile_fields to the id of the new group. The data table only seems to be looking for the id field. You can do that in phpMyAdmin. Try it locally, though, first if at all possible.
In reply to: Soon to release bp group control pluginsetting up different group types is fairly easy. You just have to attach some groupmeta to the group, that basically let you add as many types as you’d like. Then you just check the metadata to figure out what type of group you’re in. Using the groups API you can then add different functionality for different groups.
I’ve written a types-plugin for one of my sites. It doesn’t have an interface, though. The 3 types I needed are hardcoded into it, so it’s really not suited for a release at the moment. There’s also a lot of more stuff, like a shopping cart, part of that plugin. So, I’ve stripped the functions needed for group types out (hopefully al of them).
First we need to add the addtional fields to our registration form:
function sv_add_registration_group_types()
{
?>
<div id="account-type" class="register-section">
<h3 class="transform"><?php _e( 'Choose your account type (required)', 'group-types' ) ?></h3>
<script type="text/javascript" defer="defer">
jQuery(document).ready(function(){
jQuery("#account-type-normal_user").attr("checked", true);
jQuery("#group-details").hide();
jQuery("#account-type-type_one,#account-type-type_two,#account-type-type_three").click(function(){
if (jQuery(this).is(":checked")) {
jQuery("#group-details").slideDown("slow");
} else {
jQuery("#group-details").slideUp("slow");
}
});
jQuery("#account-type-normal_user").click(function(){
if (jQuery(this).is(":checked")) {
jQuery("#group-details").slideUp("slow");
} else {
jQuery("#group-details").slideDown("slow");
}
});
});
</script>
<?php do_action( 'bp_account_type_errors' ) ?>
<label><input type="radio" name="account_type" id="account-type-normal_user" value="normal_user" checked="checked" /><?php _e( 'User', 'group-types' ) ?></label>
<label><input type="radio" name="account_type" id="account-type-type_one" value="type_one" /><?php _e( 'Type 1', 'group-types' ) ?></label>
<label><input type="radio" name="account_type" id="account-type-type_two" value="type_two" /><?php _e( 'Type 2', 'group-types' ) ?></label>
<label><input type="radio" name="account_type" id="account-type-type_three" value="type_three" /><?php _e( 'Type 3', 'group-types' ) ?></label>
<div id="group-details">
<p><?php _e( 'We will automatically create a group for your business or organization. This group will be tailored to your needs! You can change the description and the news later in the admin section of your group.', 'group-types' ); ?></p>
<?php do_action( 'bp_group_name_errors' ) ?>
<label for="group_name"><?php _e( 'Group Name', 'scuba' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
<input type="text" name="group_name" id="group_name" value="" />
<br /><small><?php _e( 'We suggest you use the name of your business or organization', 'group-types' ) ?></small>
<label for="group_desc"><?php _e( 'Group Description', 'scuba' ) ?></label>
<textarea rows="5" cols="40" name="group_desc" id="group_desc"></textarea>
<br /><small><?php _e( 'This description will be visible on your group profile, so it could be used to present your mission statement for example.', 'group-types' ) ?></small>
<label for="group_news"><?php _e( 'Group News', 'scuba' ) ?></label>
<textarea rows="5" cols="40" name="group_news" id="group_news"></textarea>
<br /><small><?php _e( 'Enter any news that you want potential members to see.', 'group-types' ) ?></small>
</div>
</div>
<?php
}
add_action( 'bp_before_registration_submit_buttons', 'sv_add_registration_group_types' );Then we have to validate things and add some usermeta when a regitration happens:
/**
* Add custom userdata from register.php
* @since 1.0
*/
function sv_add_to_signup( $usermeta )
{
$usermeta['account_type'] = $_POST['account_type'];
if( isset( $_POST['group_name'] ) )
$usermeta['group_name'] = $_POST['group_name'];
if( isset( $_POST['group_desc'] ) )
$usermeta['group_desc'] = $_POST['group_desc'];
if( isset( $_POST['group_news'] ) )
$usermeta['group_news'] = $_POST['group_news'];
return $usermeta;
}
add_filter( 'bp_signup_usermeta', 'sv_add_to_signup' );
/**
* Update usermeta with custom registration data
* @since 1.0
*/
function sv_user_activate_fields( $user )
{
update_usermeta( $user['user_id'], 'account_type', $user['meta']['account_type'] );
if( isset( $user['meta']['group_name'] ) )
update_usermeta( $user['user_id'], 'group_name', $user['meta']['group_name'] );
if( isset( $user['meta']['group_desc'] ) )
update_usermeta( $user['user_id'], 'group_desc', $user['meta']['group_desc'] );
if( isset( $user['meta']['group_news'] ) )
update_usermeta( $user['user_id'], 'group_news', $user['meta']['group_news'] );
return $user;
}
add_filter( 'bp_core_activate_account', 'sv_user_activate_fields' );
/**
* Perform checks for custom registration data
* @since 1.0
*/
function sv_check_additional_signup()
{
global $bp;
if( empty( $_POST['account_type'] ) )
$bp->signup->errors['account_type'] = __( 'You need to choose your account type', 'group-types' );
if( empty( $_POST['group_name'] ) && $_POST['account_type'] != 'normal_user' )
$bp->signup->errors['group_name'] = __( 'You need to pick a group name', 'group-types' );
if( ! empty( $_POST['group_name'] ) && $_POST['account_type'] != 'normal_user' )
{
$slug = sanitize_title_with_dashes( $_POST['group_name'] );
$exist = groups_check_group_exists( $slug );
if( $exist )
$bp->signup->errors['group_name'] = __( 'This name is not available. If you feel this is a mistake, please <a href="/contact">contact us</a>.', 'group-types' );
}
}
add_action( 'bp_signup_validate', 'sv_check_additional_signup' );And then we set up the group for the user (there are some constants in this function, so you’ll need to change that):
/**
* Create custom groups for skools, biz and org accounts
* @since 1.0
*/
function sv_init_special_groups( $user )
{
global $bp;
// get account type
$type = get_usermeta( $user['user_id'], 'account_type' );
if( $type == 'normal_user' )
{
// Do nothing
}
elseif( $type == 'type_one' || $type == 'type_two' || $type == 'type_three' )
{
// get some more data from sign up
$group_name = get_usermeta( $user['user_id'], 'group_name' );
$group_desc = get_usermeta( $user['user_id'], 'group_desc' );
$group_news = get_usermeta( $user['user_id'], 'group_news' );
$slug = sanitize_title_with_dashes( $group_name );
// create dive skool group
$group_id = groups_create_group( array(
'creator_id' => $user['user_id'],
'name' => $group_name,
'slug' => $slug,
'description' => $group_desc,
'news' => $group_news,
'status' => 'public',
'enable_wire' => true,
'enable_forum' => true,
'date_created' => gmdate('Y-m-d H:i:s')
)
);
// add the type to our group
groups_update_groupmeta( $group_id, 'group_type', $type );
// delete now useless data
delete_usermeta( $user['user_id'], 'group_name' );
delete_usermeta( $user['user_id'], 'group_desc' );
delete_usermeta( $user['user_id'], 'group_news' );
// include PHPMailer
require_once( SV_MAILER . 'class.phpmailer.php' );
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = SV_SMTP;
$auth = get_userdata( $user['user_id'] );
$profile_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $slug . '/admin';
$message = sprintf( __( 'Hello %s,
we have created a group for your business or organization. To get more out of your presence on Yoursitenamehere please take some time to set it up properly.
Please follow this link to fill in the rest of your profile: %s
We wish you all the best. Should you have any questions regarding your new group, please contact us at support@yoursitenamehere.com.
Your Yoursitenamehere Team', 'group-types' ), $auth->display_name, $profile_link );
$mail->SetFrom("support@yoursitenamehere.com","Yoursitenamehere");
$mail->AddAddress( $auth->user_email );
$mail->Subject = __( 'Your new group pages on Yoursitenamehere', 'group-types' );
$mail->Body = $message;
$mail->WordWrap = 75;
$mail->Send();
}
}
add_action( 'bp_core_account_activated', 'sv_init_special_groups' );When you write a group extension we’ll have to swap the activation call with a function like the one below to be able to check for group types.
/**
* Replacement activation function for group extension classes
*/
function activate_type_one()
{
global $bp;
$type = groups_get_groupmeta( $bp->groups->current_group->id, 'group_type' );
if( $type == 'type_one' )
{
$extension = new Group_Type_One;
add_action( "wp", array( &$extension, "_register" ), 2 );
}
}
add_action( 'plugins_loaded', 'activate_type_one' );The last thing we need to do is add our group type names to group and directory pages:
/**
* Modify the group type status
*/
function sv_get_group_type( $type, $group = false )
{
global $groups_template;
if( ! $group )
$group =& $groups_template->group;
$gtype = groups_get_groupmeta( $group->id, 'group_type' );
if( $gtype == 'type_one' )
$name = __( 'Type 1', 'group-types' );
elseif( $gtype == 'type_two' )
$name = __( 'Type 2', 'group-types' );
elseif( $gtype == 'type_three' )
$name = __( 'Type 3', 'group-types' );
else
$name = __( 'User Group', 'group-types' );
if( 'public' == $group->status )
{
$type = sprintf( __( "%s (public)", "group-types" ), $name );
}
elseif( 'hidden' == $group->status )
{
$type = sprintf( __( "%s (hidden)", "group-types" ), $name );
}
elseif( 'private' == $group->status )
{
$type = sprintf( __( "%s (private)", "group-types" ), $name );
}
else
{
$type = ucwords( $group->status ) . ' ' . __( 'Group', 'buddypress' );
}
return $type;
}
add_filter( 'bp_get_group_type', 'sv_get_group_type' );
/**
* Modify the group type status on directory pages
*/
function sv_get_the_site_group_type()
{
global $site_groups_template;
return sv_get_group_type( '', $site_groups_template->group );
}
add_filter( 'bp_get_the_site_group_type', 'sv_get_the_site_group_type' );It’s quite a bit of code, but it should get you started. This hasn’t been tested with 1.2 btw.
In reply to: GalleryFirst of all, plugins are not hacks. Plugins are modular. That’s what extensibility means. You should know that as an IT journalist. If you use BuddyPress, then, yes, it’s the standard. It’s what your whole site is based on. Use something different if that fits your needs better.
WordPress was for managing posts on a blogThe key word here is ‘was’. If you know anything about WP, then you should know that by now it’s one of the most versatile CMS around.
The Zenphoto solution, not cramming everything into one plugin, is more solid and versatile.Is it just me, or does that not make much sense? You can build plugins that are applications in their own right (except that they need WP). There’s no cramming going on, mate. Only extending…
In reply to: Is the goal to strip html elements from core code?Tables for layout purposes should be avoided, but when you have tabular data, then you should use a table. That’s what these tags are for.
In reply to: GalleryI’m the last to say you shouldn’t profit from WP development, so no need to justify yourself really. I do it myself. And if you have plans to make it freely available in the future then kudos to you, mate!
Hmm, not a big fan of integrating other scripts. If there’s something available that’s built on BP or WP, then I’d rather use that, even if there are less features. If there’s something that I really need, then I’d just add it myself. I’d actually been thinking of turning NextGEN into a BP plugin. Now, I’ll have a look what Brajesh’s gallery will look like first…
Yeah, but even if you do have the key it’s not your responsibility to pay the gas bill, fill up the refrigerator or lock the front door when you get home. You might feed the cat when your neighbour is on holiday, but it’s still not your home
In reply to: GalleryWell, in the case of the gallery plugin it looks like you don’t actually pay for the plugin, but for the access to it. Once you have it, you can do whatever you want with it, the code being (well, it should be) GPL. So, if dev stops (not likely, considering that Brajesh is making money off it), you could always fork it and keep the development going, involve the community to help out as well. Shouldn’t be too hard to make a plugin compatible…
If that doesn’t work out for some reason, then you still have all the data (the actual images and the database). You then would have to migrate everything to another plugin.
In reply to: Hide some fields in profileBasically, you could extend the registration form by using one of the many hooks provided there. The data your user inputs there can then be saved as usermeta and it won’t show on their profile. Something like this:
/**
* Add xtra input field to registration form
* @since 4.0
*/
function tj_add_to_registration()
{
?>
<div id="tos" class="register-section">
<h3 class="transform"><?php _e( 'Don\'t forget...', 'traveljunkie' ) ?></h3>
<?php do_action( 'bp_accept_tos_errors' ) ?>
<label><input type="checkbox" name="accept_tos" id="accept_tos" value="agreed" /> <?php _e( 'Check this box to accept our <a href="/terms-of-service" target="_blank">Terms Of Service</a> (required)', 'traveljunkie' ) ?></label>
</div>
<?php
}
add_action( 'bp_before_registration_submit_buttons', 'tj_add_to_registration' );
/**
* Add custom userdata from register.php
* @since 4.0
*/
function tj_add_to_signup( $usermeta )
{
$usermeta['accept_tos'] = $_POST['accept_tos'];
return $usermeta;
}
add_filter( 'bp_signup_usermeta', 'tj_add_to_signup' );
/**
* Update usermeta with custom registration data
* @since 4.0
*/
function tj_user_activate_fields( $user )
{
update_usermeta( $user['user_id'], 'accept_tos', $user['meta']['accept_tos'] );
return $user;
}
add_filter( 'bp_core_activate_account', 'tj_user_activate_fields' );
/**
* Perform checks for custom registration data
* @since 4.0
*/
function tj_check_additional_signup()
{
global $bp;
if( $_POST['accept_tos'] != 'agreed' )
$bp->signup->errors['accept_tos'] = __( 'Please make sure to read our Terms of Service and then check this box!', 'traveljunkie' );
}
add_action( 'bp_signup_validate', 'tj_check_additional_signup' );I haven’t tested the above code much so there might be some bugs…
I’spose you could filter the description by using the wpautop-filter. All the html-tags you enter during the setup are probably getting taken out automatically.
In reply to: “Delete Account” Link is missing in latest trunk?Have you checked the option in the backend to allow for account deletion?
In reply to: Is BuddyPress confusing to users?The way I see it is that the blogs are the icing on the cake you get with a social network built on wp and bp. I don’t see the sense in a quick blog post form in the frontend. If you only want to write a quick note then use the activity stream. The wp backend is one of the best I have seen and I’ve worked with a lot of different systems. Why take all those goodies away from your users by restricting them to only use a few of the available features through a form on the frontend?
I mean, I would never use the QuickPress widget on the dashboard for the same reason. If you think your users will have problems with the backend interface (not likely, let em play around for an hour and they’ll be pros), then half a dozen short introductory screencasts about the various features are the way to go. Easy to make and once your users get the hang of it, they won’t want to go back. The wp backend is the most intuitive out there and it’s not gonna change anytime soon. Why should it?
With all that said I do agree that a unified look can only be beneficial to your community, so if you want to go that extra mile, then get someone to build an admin theme that mirrors the look of your site (or do it yourself).
I’ll be modifying the backend just a bit, I think. Change some colors around, add my own logo and then there’ll be a help page full with screencasts highlighting the features of both the front and the backend.