Jump to content

SMF login for wordpress comments! [small fix]


eevan79

Recommended Posts

Hi all,

 

I found some usefull instructions to SMF registed users can post on wordpress blog (using SSI.php).

Problem is when I am logged on Wordpress and SMF in same time (different account) I can see under comments form "Logged as <SMF user>", but when I submit comment, it's from Wordpress user (account).

Script first check if you are logged as SMF user, than Wordpress user.

1. I want to display both logins info (if exists) under comment form.

(I think its simple fix, but I can't make it to work.  :confused: )

 

For example:

Logged as <Wordpress account>.

Forum user: <SMF account>

[Comment form]

 

2. I dont know if it's possible to add value (in url) link to SMF user profile.

<input type="hidden" name="url" id="url" value="LINK_TO_SMF_USER_PROFILE" size="40" tabindex="3" /></p>

 

This is my script (first I include SSI.php)

 

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    <?php
    //Get username + email from SMF...
    global $context;
    if ($context["user"]["is_logged"]) 
    {
    ?>
    <p>Forum login: <strong><font color="yellow"><?php echo $context["user"]["name"]; ?>. <?php ssi_logout()?>.</p></font></strong>
    <input type="hidden" name="author" id="author" value="<?php echo $context["user"]["name"]; ?>"/>
    <input type="hidden" name="email" id="email" value="<?php echo $context["user"]["email"]; ?>"/>
    <input type="hidden" name="url" id="url" value="" size="40" tabindex="3" /></p>
    <?php
    }
    else
    {
    ?>
    
    <?php if ( $user_ID ) : ?>
    
    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out »</a></p>
    
    <?php else : ?>
    
    <p>You don't need to give user information if you first login to the forum.<br /> <a href="<?php echo get_option('siteurl'); ?>/forum/index.php?action=login" title="Login to forum">Login to forum</a>.</p>
    
    <p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>

    <p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>

    <p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
    <label for="url"><small>Website</small></label></p>
    
    <?php endif; ?>
    
    <?php 
    }
    //...Get username + email from SMF
    ?>
<!--<p><small><strong>XHTML:</strong> <?php printf(__('You can use these tags: %s'), allowed_tags()); ?></small></p>-->

<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>

<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php echo attribute_escape(__('Submit Comment')); ?>" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>

</form>

 

Thanks,

 

Ivan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.