Skip to content

Instantly share code, notes, and snippets.

@wanye71
wanye71 / frontendimage.php
Created December 8, 2012 18:25
user frontend image upload
<?php
// Processing Section
global $current_user, $wp_roles;
get_currentuserinfo();
/* Load the registration file. */
require_once( ABSPATH . WPINC . '/registration.php' );
/* If profile was saved, update profile. */
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {
@wanye71
wanye71 / animation.js
Created December 5, 2012 19:20
jquery
$("#bar")
.css({
"background":"yellow",
"border":"1px solid black"
})
.hide(2000,function(){
console.log("Animation complete!");
});
$("#bar")
.css({
@wanye71
wanye71 / arrays-in-shortcode.php
Created December 5, 2012 14:54
array values in wordpress action
class NavMenus{
public function test_nav(){
echo array(
'one' => 'This is One',
'two' => 'This is Two',
'three' => 'This is Three'
);
}
}
@wanye71
wanye71 / displayusermeta.php
Created November 19, 2012 01:45
Displays user's meta info
<?php
global $current_user;
get_currentuserinfo();
echo 'Username: ' . $current_user->user_login . "\n";
echo '<br />';
echo 'User first name: ' . $current_user->user_firstname . "\n";
echo '<br />';
echo 'User last name: ' . $current_user->user_lastname . "\n";
echo '<br />';
echo 'User display name: ' . $current_user->display_name . "\n";
@wanye71
wanye71 / addnewuserfields.php
Created November 19, 2012 01:42
Adds new fields for users
<?php
//hides the personal options
function hide_personal_options(){
echo "\n" . '<script type="text/javascript">jQuery(document).ready(function($) {
$(\'form#your-profile > h3:first\').hide();
$(\'form#your-profile > table:first\').hide();
$(\'form#your-profile\').show();
$(\'label[for=url], input#url\').hide();
});
@wanye71
wanye71 / frontend.php
Created November 18, 2012 15:03
Registration
<?php
/**
* Template Name: User Profile
*
* Allow users to update their profiles from Frontend.
*
*/
/* Get user info. */
global $current_user, $wp_roles;
@wanye71
wanye71 / auto-assign.php
Created November 17, 2012 22:21
Auto Assigning Categories To Posts
<?php
function sce_create_page($user_id){
$the_user = get_userdata($user_id);;
$new_user_name = $the_user->user_login;
$my_post = array();
$cat_name = wp_create_category('premium');
$my_post['post_title'] = $new_user_name . $cat_name;
$my_post['post_type'] = 'post';
$my_post['post_content'] = '';
$my_post['post_status'] = 'publish';