Forum Replies Created

Viewing 15 replies - 76 through 90 (of 202 total)
  • Thread Starter Modifiedcontent

    (@modifiedcontent)

    There are probably more clues in here.

    Thread Starter Modifiedcontent

    (@modifiedcontent)

    Following up on my question about preselecting only recently updated blogs in the query; the database table wp_blogs does have a column last_updated.

    @godlike’s code has this query:

    $query = "SELECT blog_id FROM $wpdb->blogs WHERE blog_id !='1'";

    So you could add something like “AND WHERE last_updated < ‘last week’ ORDER BY last_updated DESC LIMIT 5”? What is the correct way to do that?

    I get this error on individual feeds of network sites:

    This page contains the following errors:

    error on line 1 at column 29: Invalid XML encoding name

    About 80% of Multisite users, at the last check (based on people who reply to such surveys), use Multisite for multiple, separate, sites

    Who are these people? I really can’t imagine many cases where that would make much sense, except maybe a big hosting company or a blog farm advertising scam.

    Those 80% are probably lots of kids in basements starting their own blog farms that never go anywhere.

    WordPress is developed by and for PHP tinkerers, piling on features on top of “what it is” without much thought to what it could be, how it could be used in the real world.

    Creating a members blog feels like a illogical workaround that will only cause problems down the line. It still wouldn’t help make a network-wide view of latest posts etc. easier to accomplish.

    Apologies for hijacking/derailing this thread. Was the original question answered? In general, is there a way to make WP_user_query work in multisite, maybe in combination with the blog_id switch stuff?

    Thanks for your response.

    … over 300 times I’ve been asked why you can’t get rid of the /blog/ slug in SubDirectory installs …

    That’s another one I wasted one or two days on solving.

    Or go check out BuddyPress

    I have tried Buddypress for about two years since it first came out and it just got worse and worse. I have just junked that pile of garbage and am now trying to simplify/streamline my projects on standard WP multisite with as few plugins as possible.

    The Multisite User Management plugin is mentioned for every multisite user management problem and is simply not a solution. It only lets you manually add users to blogs on the network, which is useless if you try to use multisite for a company or membership organization.

    Yes, WordPress Multisite was designed to with WordPress.com in mind as the sample.

    Why?! Who would use it like that?

    This also works:

    <?php
    
     $querystr = "
        SELECT $wpdb->users.*
        FROM $wpdb->users
        ORDER BY $wpdb->users.user_registered DESC LIMIT 10
     ";
    
     $listmembers = $wpdb->get_results($querystr, OBJECT);
    
     ?>
     <?php if ($listmembers): ?>
     <?php global $member; ?>
     <?php foreach ($listmembers as $member): ?>
     <?php setup_postdata($member); ?>
    <p><? echo $member->display_name ?></p>
     <?php endforeach; ?>
     <?php else: ?>
        <h2>You got nuthin...</h2>
     <?php endif; ?>

    Again, are there arguments against this approach? Is there a better way?

    To get from here to the blog specific data raskull needed is another story of course. These multisite functions and methods could be useful.

    This basically works:

    <?
    $wp_user_search = $wpdb->get_results("SELECT ID, display_name, user_registered FROM $wpdb->users ORDER BY user_registered DESC LIMIT 7");
    foreach ( $wp_user_search as $userid ) {
    	$user_id       = (int) $userid->ID;
    	$user_login    = stripslashes($userid->user_login);
    	$display_name  = stripslashes($userid->display_name);
    	$return  = '';
    	$return .= "\t" . '<li>'. $display_name .'</li>' . "\n";
    	print($return);
    }
     ?>

    Now I have to figure out how to split the return/echo stuff from the PHP…

    What are the arguments against doing it this way? Are there better ways? Maybe using WP_User_Query somehow?

    I’m trying to figure out the same thing and it is utterly ridiculous that this should require complicated custom coding or plugins.

    Automattic apparently developed multisite for the WordPress.com use case; a network of blogs that are completely independent of eachother. That use case would make sense for maybe a big hosting company.

    Normal people in the real world will almost never use multisite that way. Most will try to use WP multisite as a network for an organization or company, only to find out the hard way that letting “users” interact on the platform is virtually impossible.

    Yes, being forced to add all users to the main blog is “a semantically sad use of the multisite framework”. In my case the main blog is used for organization news and announcement, so it’s the last place I want to have overrun by members/”users”.

    So we’re supposed to use half-baked plugins and hacks to fix the mess again.

    Can anyone give a basic example of a custom query to list all users in the ‘users’ database table?

    Thread Starter Modifiedcontent

    (@modifiedcontent)

    WordPress/Automattic deemed this plugin territory four years ago.

    So where are the reliable plugins to achieve this essential functionality?

    Thread Starter Modifiedcontent

    (@modifiedcontent)

    Have there been any changes affecting add_signup_meta in the last upgrades? It’s not depracated is it?

    I get similar results as above with any add_signup_meta code snippet I try, in another installation as well.

    Why do I only get ‘”companyname”;N’ etc. in the meta column, no values? Can’t figure out where the problem is. Any suggestions appreciated.

    Thread Starter Modifiedcontent

    (@modifiedcontent)

    I found this code that looks very promising:

    /**
     * Add cutom field to WPMU registration form
     */
    add_action('signup_extra_fields','custom_signup_extra_fields', $errors);
    
    // this in an example with a text input
    function custom_signup_extra_fields($errors) {
    ?>
    	<label for="companyname">Company name: <input id="companyname" class="input" type="text" value="<?php  echo esc_attr($_POST['companyname']) ?>" name="companyname"/>
    	<br />
    
    	<label for="e_mail_updates"><input type="checkbox" name="e_mail_updates" id="e_mail_updates" <?php if(isset($_POST['e_mail_updates'])) checked('true', $_POST['e_mail_updates']); ?> value="true" /> I would like to receive e-mail updates
    	</label>
    	<br />
    
    <?php
    }
    
    /**
     * Save custom field input to wp_signups table
     */
    add_filter( 'add_signup_meta', 'custom_add_signup_meta' );
    
    function custom_add_signup_meta ( $meta = array() ) {
    
    	// create an array of custom meta fields
    	$meta['custom_usermeta'] = array(
    		// 'meta_key' => $_POST['input_field'],
    		'companyname' => $_POST['companyname'],
    		'e_mail_updates' => $_POST['e_mail_updates']
    		);
    
    	return $meta;
    
    }
    
    /**
     * Set new usermeta upon new user activation
     */
    add_action( 'wpmu_activate_user', 'custom_add_new_user_meta', 10, 3 );
    
    function custom_add_new_user_meta( $user_id, $email, $meta ) {
    
    	if ( $meta['custom_usermeta'] ) {
    		// loop through array of custom meta fields
    		foreach ( $meta['custom_usermeta'] as $key => $value ) {
    			// and set each one as a meta field
    			update_user_meta( $user_id, $key, $value );
    		}
    	}
    
    }

    I tried the original from pastebin and my version above with another text field added. Nothing shows up in usermeta unfortunately. Something goes wrong posting the values.

    Here’s what ends up in the wp_signups table:

    a:3:{s:7:"lang_id";i:1;s:6:"public";i:1;s:15:"custom_usermeta";a:2:{s:11:"companyname";N;s:14:"e_mail_updates";N;}}

    I assume the N stands for Null; no data, so nothing to move to usermeta.

    Does anyone know how to fix this? Why aren’t the values stored?

    Thread Starter Modifiedcontent

    (@modifiedcontent)

    Nevermind. Found the solution:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    OBJECT_K?! WTF?!

    Why did I need an obscure solution like that to make something this basic work? Or is there a more obvious solution?

    The duplicates no longer show up, but they still mess up the post count (LIMIT). Can I define the LIMIT somewhere after OBJECT_K?

    Should I use a query with get_row? How would that look? I’ve tried several variations, but haven’t been able to make it work.

    Thanks!

    I’ve tried adding the filter. It does change the welcome email to the version from your plugin, but the firstname + lastname tags no longer work.

    For now I’ll go back to my edit in ms-functions.php, where I added this:

    $fullname = $meta[field_1];

    and

    $welcome_email = str_replace( "FULLNAME", $fullname, $welcome_email );

    So I can use FULLNAME in the regular WP email editor.

    I’d prefer a plugin for this though.

    Or can I create a custom function in my theme’s functions.php and then use an add_filter line like the one you gave me to redirect a call to wpmu_welcome_user_notification() to that function?

    Thanks for the quick response.

    I found my custom code solution again. It’s an edit in function wpmu_welcome_user_notification in ms-functions.php – that file is still there after all.

    Where does that function fit it? Where is it “called” in the registration process? Should I replace it with something else so I can use the excellent-looking SB Welcome Email plugin?

    Buddypress has been a constant source of frustation for me as well. At one point they changed all the template tags, making it pretty much impossible for me to upgrade my heavily customized theme.

    BP development was going off the rails anyway imho, so I’m phasing it out, but I still have too much code that depends on BP.

    Just downloaded and installed the latest version of the SB Welcome Email plugin on a WordPress 3.1.3 multisite install.

    It looks fine if you send a test email, but if you actually register you still get the same old BS email.

    I am using a customized registration process based on WPMU and Buddypress. That could be part of the problem, but many potential users of this plugin will be in a similar situation.

    I have no clue how to troubleshoot this. I used to have my own fix hardcoded in wpmu-functions.php, but I think that file is no longer there. Any help appreciated.

    Why the %#!@ is it still impossible in WordPress to edit the welcome email?!

    Automattic only seems to listen to code hobbyists. They are absolutely horrible where it comes to end-user interface and just general common sense. I’m really sick of having to waste time on this issue every time I upgrade a site.

Viewing 15 replies - 76 through 90 (of 202 total)