Removing Login Fields From Justin Kliens WP-Facebook-Autoconnect

First of all I would like to say thanks to Justin for the plugin, it saved me some time :)
You can find his easy to use plugin at his personal blog site: http://www.justin-klein.com/projects/wp-fb-autoconnect/

This modification will work with Version 1.3.10

After about half an hour I was able to find the code that was causing a second duplicate login and password field. I am sure Justin was thinking ahead with the login fields but in some cases it actually interferes with the blog design/UI. The other problem was the welcome and edit profile links once logged in.

The block of code is found in 2 sections within Widget.php

The First NULLED section will remove the Welcome and Edit profile links once a user is logged in.
The Second NULLED section of code will remove the login fields.

Widget.php
Note: you can copy and past this entire code onto your Widget.php file to update it or download the file directly from the link at the bottom of this post.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php

/**

  * Sidebar LoginLogout widget with Facebook Connect button

  **/


class Widget_LoginLogout extends WP_Widget

{

    //////////////////////////////////////////////////////

    //Init the Widget

    function Widget_LoginLogout()

    {

        $this->WP_Widget( false, "WP-FB AutoConnect", array( 'description' => 'A sidebar Login/Logout form with Facebook Connect button' ) );

    }

     

    //////////////////////////////////////////////////////

    //Output the widget's content.

    function widget( $args, $instance )

    {

        //Get args and output the title

        extract( $args );

        echo $before_widget;

        $title = apply_filters('widget_title', $instance['title']);

        if( $title ) echo $before_title . $title . $after_title;

       

        //If logged in, show "Welcome, User!"

        $userdata = wp_get_current_user();

        if( $userdata->ID ):

        ?>

<?php /*?>            
########################################################################
########################################################################
########################################################################
           
NULLED  TO PREVENT THE WELCOME MESSAGE ONCE THE USE IS LOGGED IN-->
           
            <div style='text-align:center'>

              <?php echo __('Welcome') . ', ' . $userdata->display_name?>!<br />

              <small>

                <a href="<?php echo get_settings('siteurl')?>/wp-admin/profile.php"><?php _e("Edit Profile")?></a> | <a href=" <?php echo wp_logout_url( $_SERVER['REQUEST_URI'] )?>"><?php _e("Logout")?></a>

              </small>

            </div>
           
## END OF NULL <--
 */
?>

        <?php

        //Otherwise, show the login form (with Facebook Connect button)

        else:

        ?>

<?php /*      

########################################################################
########################################################################
########################################################################
           
NULLED TO PREVENT THE WIDGETS LOGIN FIELDS-->
   
                <form name='loginform' id='loginform' action='<?php echo get_settings('siteurl')?>/wp-login.php' method='post'>

                <label>User:</label><br />

                <input type='text' name='log' id='user_login' class='input' tabindex='20' /><input type='submit' name='wp-submit' id='wp-submit' value='Login' tabindex='23' /><br />

                <label>Pass:</label><br />

                <input type='password' name='pwd' id='user_pass' class='input' tabindex='21' />

                <span id="forgotText"><a href="<?php echo get_settings('siteurl')?>/wp-login.php?action=lostpassword"><?php _e('Forgot')?>?</a></span><br />

                <?php //echo "<input name='rememberme' type='hidden' id='rememberme' value='forever' />";?>

                <?php echo wp_register('',''); ?>

                <input type='hidden' name='redirect_to' value='<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>' />

            </form>
           
##END OF NULL <--
*/
?>
            <?php

            global $opt_jfb_hide_button;

            if( !get_option($opt_jfb_hide_button) )

            {

                jfb_output_facebook_btn();

                jfb_output_facebook_init();

                jfb_output_facebook_callback();

            }

        endif;

        echo $after_widget;

    }

   

   

    //////////////////////////////////////////////////////

    //Update the widget settings

    function update( $new_instance, $old_instance )

    {

        $instance = $old_instance;

        $instance['title'] = $new_instance['title'];

        return $instance;

    }



    ////////////////////////////////////////////////////

    //Display the widget settings on the widgets admin panel

    function form( $instance )

    {

        ?>

        <p>

            <label for="<?php echo $this->get_field_id('title'); ?>"><?php echo 'Title:'; ?></label>

            <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />

        </p>

        <?php

    }

}





//Register the widget

add_action( 'widgets_init', 'register_jfbLogin' );

function register_jfbLogin() { register_widget( 'Widget_LoginLogout' ); }



?>

Once you have made the 2 listed changes your facebook button may be out of alignment from your theme, to simply fix this add some padding using css in the following file:

Main.php (lines 105-109)

1
2
3
<script type="text/javascript">// <![CDATA[
    document.write('<span id="fbLoginButton" style=""><fb:login-button v="2" size="large" onlogin="();">Login with Facebook</fb:login-button></span>');
// ]]></script>

If this too much code for you and you just want the login fields gone download the following files and replace the ones in your x:/wp-content/plugins/wp-fb-autoconnect folder.

Download Files