Skip to:
Content
Pages
Categories
Search
Top
Bottom

Passing FORM variable to buddypress create site template


  • maddogmcewan
    Participant

    @maddogmcewan

    Anybody know how I could pass the $blogname variable from a html form to the buddypress create a new site form field?

    I am replicating something similar as found here https://wordpress.com/ and from the form have tried both a GET and POST method

    In my themes’ blogs/create.php i tried ` $blogname = $_REQUEST[‘site’];
    echo $blogname;` also tried $blogname = $_POST, but no luck

    I would like the blogname form field in the create pre populated with the form post from my landing screen

Viewing 4 replies - 1 through 4 (of 4 total)

  • Henry Wright
    Moderator

    @henrywright


    maddogmcewan
    Participant

    @maddogmcewan

    hi henry thanks you am going to try that – i managed to echo the variable in the footer using $blogname = esc_attr( $_REQUEST['site'] ) ; but the next trick is to replace the empty value in the site domain textbox with the form post value. Will let you know. Thank you for the help


    maddogmcewan
    Participant

    @maddogmcewan

    excellent got it working. I added this to the footer area in create.php

    <?php get_footer( 'buddypress' ); 
    	$blogname = esc_attr( $_REQUEST['site'] ) ;
    ?>
    
    <script language="javascript">
    var blogname;
    blogname = document.getElementById('blogname');
    if(blogname){
    blogname.value = "<?php echo $blogname;?>";
    }
    </script>

    maddogmcewan
    Participant

    @maddogmcewan

    replace that 2nd line with $blogname = esc_attr( sanitize_html_class( $_REQUEST['site'] )) ;

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Passing FORM variable to buddypress create site template’ is closed to new replies.
Skip to toolbar