Skip to content

Instantly share code, notes, and snippets.

@squirelo
squirelo / gist:4413129
Created December 30, 2012 14:58
Just a snippet
body {
font-family: "OpenSans", Helvetica, Arial, sans-serif;
}
.pull-right-footer {
text-align: center;
padding-top: 20px;
}
@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' ) {
@RalfAlbert
RalfAlbert / index.php
Created December 2, 2012 14:05
Insert custom fields at user registration v2
<?php
/**
* Plugin Name: Custom user registration fields
* Plugin URI: http://yoda.neun12.de
* Description: Add custom fields to the user registration
* Version: 0.1
* Author: Ralf Albert
* Author URI: http://yoda.neun12.de
* Text Domain:
* Domain Path:
@RalfAlbert
RalfAlbert / index.php
Created December 2, 2012 12:39
Insert custom fields at user registration
<?php
/**
* Plugin Name: Custom user registration fields
* Plugin URI: http://yoda.neun12.de
* Description: Add custom fields to the user registration
* Version: 0.1
* Author: Ralf Albert
* Author URI: http://yoda.neun12.de
* Text Domain:
* Domain Path:
public function profile_save( $user_id ) {
$fields = self::$setup['theme']['profile']['fields'];
if ( !current_user_can( 'edit_user', $user_id ) ) return false;
foreach ($fields as $field => $attr) {
if ( isset($_POST[$field]) || isset($_FILES[$field]) ) {
$value = $_POST[$field];
if ( $value ) update_user_meta( $user_id, $field, $value );
}
}
}
@kcoss
kcoss / gist:4148869
Created November 26, 2012 15:45
CSS Default Menu Theme "Minimal"
/* NAVIGATION MENU --------------------*/
.navbar, .navbar-inner, .nav, .navbar-inverse {
float: none;
}
.navbar-inverse .btn-navbar {
background: #666;
margin-top: 20px;
}
.navbar,.navbar-inverse .navbar-inner {
background: none;
@rawaludin
rawaludin / gist:4110578
Created November 19, 2012 13:14
jquery : smooth scroll
$(document).ready(function() {
// animation of navigation
$(function() {
$('.nav-collapse .nav li a').bind('click',function(event){
var anchor = $(this);
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top - $('.navbar-inner').height() - ($('.navbar-inner').height()/4.8)
}, 1500/*,'easeInOutExpo'*/);
@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;