Skip to content

Instantly share code, notes, and snippets.

View AladinDridi's full-sized avatar
🎯
Focusing

Aladin Dridi AladinDridi

🎯
Focusing
  • Montréal
View GitHub Profile
@AladinDridi
AladinDridi / add costum words in page my courses leardnash buddypress
Last active June 20, 2017 13:56
add costum words in page my courses leardnash buddypress
<?php
global $current_user;
get_currentuserinfo();
switch (true) {
case ( user_can( $current_user, "subscriber") ):
echo '<img src="http:www.impho.com/images/001.jpg">';
break;
case ( user_can( $current_user, "contributor") ):
echo '<img src="http:www.impho.com/images/002.jpg">';
break;
@AladinDridi
AladinDridi / widget show author
Last active June 5, 2017 14:07
display author name in widget wordpress
<?php if(is_home() || is_single()){
echo get_the_author($post->post_author);
echo '
<style>
.linklien{
border: 2px solid #444 ;
background-color:blue;
}
</style>
1/write script shell like this
#!/bin/bash
ERRLOG=/path/wgetcron.log
TARGET=http://www.example.org/wp-content/plugins/paid-memberships-pro/scheduled/expirememberships.php
UA=WgetCron-ViaPlanficateursTachesOVH
wget -nv -U $UA -O /dev/null $TARGET >/dev/null 2>>$ERRLOG
2/chmod +x script
3/crontab -e and add the script
@AladinDridi
AladinDridi / gist:b2aac59c7b0a9369a53d3ad7f85e8901
Created April 18, 2017 13:30
Call function to change role by html5 submit button
<html>
<body>
<form action="localhost/change_role_7%C3%A8me.php" method="get">
<input type="submit" name="on" value="on">
<input type="submit" name="off" value="off">
</form>
</body>
</html>
<?php
if(isset($_GET['on'])) {
@AladinDridi
AladinDridi / my_vc_shortcode
Last active July 2, 2017 14:01
shortcode for enroll users to course -learndash
function my_vc_shortcode( $atts ) {
global $current_user;
get_currentuserinfo();
switch (true) {
case ( user_can( $current_user, "7eme") && is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') && @!pmpro_hasMembershipLevel() ):
$course_id = learndash_get_course_id( $post_id );
$user = get_current_user_id();
return ld_update_course_access($user, $course_id=111, $remove = false);
break;
}
<?php
// Set your timezone!!
$connection = mysql_connect("localhost","root");
mysql_select_db("bd_events") or die("no database");
// Set your timezone!!
date_default_timezone_set('Africa/Tunisia');
// Get prev & next month
<?php
require_once('select_projects.php');
$projects=utf8_encode($option2);
$host="localhost";
$user="root";
$pass="";
$db="calendar";
$connect=mysqli_connect($host,$user,$pass,$db);
if(isset($_POST['stat'])&&($_POST)){
$name=$_POST['stat'];
<?php
require_once('select_projects.php');
$projects=utf8_encode($option2);
$host="localhost";
$user="root";
$pass="";
$db="calendar";
$name=$_POST['stat'];
$connect=mysqli_connect($host,$user,$pass,$db);
$query = "SELECT status, count(*) as number FROM taches WHERE projets='$name' GROUP BY status";
<html>
<head>
<meta charset="utf-8">
<Title>Les selecteurs en css3</Title>
<style type="text/css">
body{
background-color: aliceblue;
}
h3{
font-family: cursive;
<?php
require_once("wp-load.php");
//or//
$incPath = str_replace(ABSPATH,"",getcwd());
include($incPath.'/wp-load.php');
$uploads_dir = wp_upload_dir();
//||(function_exists('pmpro_hasMembershipLevel'))&&(pmpro_hasMembershipLevel())// maybe i need this
//if(!is_user_logged_in()){
//exit;//