Skip to content

Instantly share code, notes, and snippets.

View hypeJunction's full-sized avatar

Ismayil Khayredinov hypeJunction

View GitHub Profile
@hypeJunction
hypeJunction / ElggForm.php
Created August 8, 2012 09:13
ElggForm API
<?php
class ElggForm {
// $name should correspond to the Elgg action, e.g. ‘blogs/add’
function __construct($name, $params);
function registerInput($name, $options); // adds an input; should return form or input?
function getInput($name); // returns the input
function removeInput($name); // returns the removed input
@hypeJunction
hypeJunction / step_one.php
Last active December 18, 2015 04:18
Elgg/Elgg #5598
$user = elgg_get_logged_in_user_entity();
// Create test blog entry with some metadata
$location = 'New York City, USA';
$tags = array('photography', 'web design', 'art');
$blog = new ElggObject();
$blog->subtype = 'blog';
$blog->title = 'Some title';
$blog->description = 'Some content';
elgg_register_event_handler('init', 'system', 'custom_blog_notification_init');
function custom_blog_notifier_init() {
//Register an event listener to send email when blog is created
elgg_register_event_handler('publish', 'blog', 'custom_blog_notification_send');
}
/**
* Callback function to send a notification
@hypeJunction
hypeJunction / forms.php
Created January 27, 2014 11:56
Theme Sandbox : Forms
<style type="text/css">
.elgg-form .elgg-col {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0 0 15px 0;
width: 100%;
float: left;
}
@hypeJunction
hypeJunction / MenuScraper.php
Last active August 29, 2015 13:55
Build a tree of Elgg menu items
<?php
/**
* @author Ismayil Khayredinov <ismayil.khayredinov@gmail.com>
* @package hypeJunction
* @subpackage Util
*
* This class attemps to build a tree of menu items that are registered
* throught the plugins
* The list of items is not definitive
@hypeJunction
hypeJunction / groups.md
Created February 6, 2014 16:28
Understanding Elgg Groups

Understanding Elgg Groups

The definitions below are of the default core behaviorr. Third-party plugins may have altered this behaviour.

Group Owner

Group Owner is a user that (alongside the administrators) has privileges to edit group description and perform other management operations that require canEdit permissions.

@hypeJunction
hypeJunction / edit_commit_messages.sh
Last active August 29, 2015 13:56
Working with Elgg Repos
# Correct typos and edit commit messages
# Helpful when Evan complain about the commit message
# Move to your issue branch
git checkout issue_branch
# Find where the HEAD was when you added a wrong commit message
git reflog
# Let's say head was HEAD@{5}
@hypeJunction
hypeJunction / example.php
Last active June 25, 2016 16:46
Elgg 1.9 - show hidden/disabled entities
<?php
namespace MyPlugin;
elgg_register_plugin_hook_handler('get_sql', 'access', __NAMESPACE__ . '\\filter_access_sql');
/**
* Filter access sql to display disabled entities
*
* @param string $hook 'get_sql'
@hypeJunction
hypeJunction / update.php
Last active August 29, 2015 14:07
Update Elgg bookmarks address hostname
<?php
/**
* Update bookmarks address host
*
* @param string $src_url Source url e.g. http://www.old-example.com/
* @param string $target_url Target url e.g. http://subdomain.new-example.com/
* @return boolean
*/
function bookmarks_modify_address_host($src_url, $target_url = null) {
@hypeJunction
hypeJunction / ws-test.php
Created June 9, 2015 13:49
Testing Elgg Web Services Locally
<?php
define('WS_API_DOMAIN', 'http://xxxxxxxxxxxx.com/');
define('WS_TEST_API_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
define('WS_TEST_USERNAME', 'xxxxxxxxxxxxxxxxxxx');
define('WS_TEST_PASSWORD', 'xxxxxxxxxxxxxxxx');
function ws_test_build_url($method, $auth_token = null) {