Forum Replies Created

Viewing 15 replies - 1 through 15 (of 34 total)
  • Thread Starter MYGM

    (@mygm)

    Thanks that seems to be it. However the membership id, is that a unique number per user? Cause I was looking to use numbers that correlate to the actual membership levels?

    Thread Starter MYGM

    (@mygm)

    Hi thanks for the response however my links are custom coded and I need more control than that within my theme templates. Is there a code snippet you can provide?

    Thread Starter MYGM

    (@mygm)

    thanks for the reply however, how would i fit that into my previous code and echo it out ?

    Thread Starter MYGM

    (@mygm)

    Help…

    Thread Starter MYGM

    (@mygm)

    ANYONE?

    Im having the same problem. It only happens when the plugin is activated.

    Thread Starter MYGM

    (@mygm)

    I figured out how to add default pages for multisites, but how do I remove the TML default pages?

    add_action('wpmu_new_blog', 'create_my_pages', 10, 2);
    
    function create_my_pages($blog_id, $user_id){
      switch_to_blog($blog_id);
    
      // not really need, new blogs shouldn't have any content
      if(get_page_by_title('About')) return;
    
      // create each page
      $page_id = wp_insert_post(array(
        'post_title'     => 'About',
        'post_name'      => 'about',
        'post_content'   => 'This is your about page',
        'post_status'    => 'publish',
        'post_author'    => $user_id, // or "1" (super-admin?)
        'post_type'      => 'page',
        'menu_order'     => 1,
        'comment_status' => 'closed',
        'ping_status'    => 'closed',
         // + see: http://codex.ww.wp.xz.cn/Function_Reference/wp_insert_post
      ));  
    
      restore_current_blog();
    }
    Thread Starter MYGM

    (@mygm)

    Hi,
    Thanks for your response, however Im not sure if my question was understood correctly. I use TML as well, but that doesn’t have anything to do with my problem.

    Whenever I log in I`am redirected to the membership levels page, this is caused by your plugin. How can I fix it so that the plugin does not redirect me anywhere, at all, upon log in. My forms work correctly when pmbpro is deactivated. Is there a way to stop the plugin from redirecting?

    Thread Starter MYGM

    (@mygm)

    Hi,
    thanks for the response. I am working on figuring it out myself, but maybe any hints or tips to point me in the right direction can help.

    This is what I have so far, and it’s displaying users but it is displaying all users instead of those with the specified membership id —

    `<?php
    $member_ids = $wpdb->get_col(“SELECT user_id FROM $wpdb->memberships_users WHERE membership_id = ‘4’”);
    $level1users = get_users(array(“include”=>$member_ids));
    foreach($level1users as $user) : // start users’ profile “loop”
    ?><?php echo $user->user_email; ?> <?php
    endforeach; // end of the users’ profile ‘loop’
    ?>`

    What am I missing?

    Thread Starter MYGM

    (@mygm)

    I unticked the force ssl and tried using the wordpress https plugin to secure the page, however it did not work and this is what Im receiving in the debug console —

    <script type="text/javascript">
    	if ( typeof console === 'object' ) {
    		console.log('[BEGIN WordPress HTTPS Debug Log]');
    		console.log('Version: 3.3.6');
    		console.log('HTTP URL: http://MYSITE.com/');
    		console.log('HTTPS URL: https://MYSITE.com/');
    		console.log('SSL: No');
    		console.log('Diff Host: No');
    		console.log('Subdomain: No');
    		console.log('Proxy: No');
    		console.log('Secure External URLs: [  ]');
    		console.log('Unsecure External URLs: [  ]');
    		console.log('[ERROR] Redirect Loop!');
    		console.log('[FIXED] Element: <script> https://js.stripe.com/v1/?ver=3.4.2 => http://js.stripe.com/v1/?ver=3.4.2');
    		console.log('[END WordPress HTTPS Debug Log]');
    	}
    </script>

    Yeah I would like to know as well.

    Thread Starter MYGM

    (@mygm)

    Ok Im almost there. Using the code you provided I was able to retrieve the blog url however it is echoing the url for both the main blog and the users blog. How can I make it so that it only echoes the users blog and not the primary/main blog on the network??

    This is how my code currently looks –

    <?php if(is_user_logged_in()) {
    global $current_user;
      $blogs = get_blogs_of_user( $current_user->id );
         if($blogs) {
         	 foreach ( $blogs as $blog ) {
             echo '<li><a href="http://' . $blog->domain . $blog->path .'upload-document/">My Documents</a></li>';
             echo '<li><a href="http://' . $blog->domain . $blog->path .'upload-document/?ptype=settings&tab=gateways">Settings</a></li>';
    
    		}
         }
    } ?>
    	<?php endif; ?>
    Thread Starter MYGM

    (@mygm)

    Im using a custom form –

    <?php
    if(get_option('users_can_register')) {
    //Check whether user registration is enabled by the administrator
    ?>
    
    <?php
    
    if($_POST){
        //We shall SQL escape all inputs
        $username = $wpdb->escape($_REQUEST['username']);
        if(empty($username)) {
            echo "<span style='color:#FF0000'><strong>Error..</strong></span><br /><br />You have to fill in the username.";
            exit();
        }
        $email = $wpdb->escape($_REQUEST['email']);
        if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email)) {
            echo "<span style='color:#FF0000'><strong>Error..</strong></span><br /><br />please use a calid e-mailadress.";
            exit();
        }
    
        $pass1 = $wpdb->escape($_REQUEST['pass1']);
    $pass2 = $wpdb->escape($_REQUEST['pass2']);
    if ($pass1 != $pass2){
        echo "<span style='color:#FF0000'><strong>Error..</strong></span><br /><br />please use a passwords don't match.";
            exit();
    
    }
    $random_password = $pass1;
        $status = wp_create_user( $username, $random_password, $email );
        if ( is_wp_error($status) )
            echo "<span style='color:#FF0000'><strong>Feil..</strong></span><br /><br />Username allready exist. please try another one.";
        else {
            $from = get_option('admin_email');
            $headers = 'From: '.$from . "\r\n";
            $subject = "Registration ok!";
            $msg = "Welcome, you are now registered. Here is your username and password.\Info:\Username: $username\Password: $random_password";
            wp_mail( $email, $subject, $msg, $headers );
            echo "<strong>You are now registered. An e-mail is now sent to you with your username and password..";
        }
    
        exit();
    
    }
     else
    {
    //Embed the register form and javascript here
    
    ?>
    
    <div id="result"></div>
    <div style="padding-top:5px;"><h2 style="font-size:16px;color:#06f;">Register</h2></div>
    
    <form id="wp_signup_form" action="" method="post">
    <p><label>Username<br />
    <input type="text" name="username" style="width:250px; margin-bottom:3px;"></label></p>
    <p><label>E-Mail<br />
    <input type="text" name="email" style="width:250px; margin-bottom:3px;"></label></p>
    <p><label>Password<br />
    <input type="password" name="pass1" style="width:250px; margin-bottom:3px;"></label></p>
    <p><label>Repeat Password<br />
    <input type="password" name="pass2" style="width:250px; margin-bottom:3px;"></label></p>
    <br />
    <input type=checkbox name="termsnp">By registering I agree to the terms and policy<br /><br />
    <input type="submit" id="submitbtn" name="submit" value="Register" class="knapp" style="padding:8px;">
    </form>
    <script type="text/javascript">
    $("#submitbtn").click(function() {
    $('#result').html('<img src="<?php bloginfo('template_url'); ?>/images/loader.gif" class="loader" />').fadeIn();
    var input_data = $('#wp_signup_form').serialize();
    $.ajax({
    type: "POST",
    url:  "<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
    data: input_data,
    success: function(msg){
    $('.loader').remove();
    $('
    <div>').html(msg).appendTo('div#result').hide().fadeIn('slow');
    }
    });
    return false;
    
    });
    </script>
    <?php
    // embedded
    
    }
    ?>
    
    <?php
        }
    ?>
    Thread Starter MYGM

    (@mygm)

    Ok thanks, I understand but for now though I am looking to resolve this issue – Users that create a new blog/site should be admins of their site but for some reason that doesn’t seem to be happening.

    My other option would be, if I can’t make the above work like it should, then how can I modify the following code to check if a user has a site or not on the network –

    <?php global $wp_roles;
    foreach ( $wp_roles->role_names as $role => $name ) :
    if (current_user_can( $role ) && $role == 'administrator') { ?>
                    <?php if ( class_exists( 'MarketpressFadminWidget' ) ) { ?>
     <?php
     $mp_frontend_settings = get_option( 'mp_frontend_settings' );
     $mp_frontend_settings = unserialize($mp_frontend_settings);
     $adminpage = $mp_frontend_settings['page_id'];
     $permalink = get_permalink($adminpage);
     ?>
    //My Links/Content
    
     <?php } ?>
    Thread Starter MYGM

    (@mygm)

    Hi Thanks for the response.

    Ok I understand what you are saying so let me clarify –

    I have this plugin Marketpress and a front end add on for it which allows users to do everything (manage their products etc. ) on the front end. It is used for ecommerce and in order for a user to have their own ‘store’ they have to create a blog/site. They wont use this blog for nothing other then the functions that are available to them on the front end.

    So I would like to keep it so that only super admins can access the back end. However they need to be an admin so that they can use these store functions on the front end.

    So basically I need them to be admins of their own blog but whenever a user signs up for a blog they do not become admins but instead remain contributors. I hope this makes sense, but if not I can clarify further.

    I really appreciate any help on this.

Viewing 15 replies - 1 through 15 (of 34 total)