User
Adding a new User in Concrete5
$data = array('uName' => 'test', 'uPassword' => 'xxxxx', 'uEmail' => 'test@test.com');
$userObj = UserInfo::add($data);
$user_id = $userObj->getUserID(); // returns the newly inserted user details
Getting User info by username, id, email in Concrete5
$user = UserInfo::getByUserName('test');
$user = UserInfo::getByEmail('email id');
$user = User::getByUserID($uID);
Getting user information from user object
$user->getUserName();
$user->uGroups;
Getting the current logged in user info
$curUser = new User();
Adding a User to a Group
$user->enterGroup($groupObj);
Logging in with user id in Concrete5
User::loginByUserID($uID);
Logging out from Concrete5
$user = new User();
$user->logout();
Group
Adding a new group
Group::add('name', 'description');
Getting group info using id and name
$group = Group::getByName($gname);
$group = Group::getByID($gID);
$group_id = $group->getGroupID();
$group_name = $group->getGroupName();
$group_desc = $group->getGroupDescription();
Page
Creating a new Page
$parent = Page::getByID(1); // Home page
$ct = CollectionType::getByHandle('page');
$data = array('cName'=>'My Page', 'cDescription'=>'My Page Description', 'cHandle'=>'my-page');
$p = $parent->add($ct, $data);
Deleting a Page
$page = Page::getByID($pageID);
or
$page = Page::getByHandle('my-page');
$page->delete();
Installing Block and Theme
Installing a custom block
BlockType::installBlockType('custom_block');
Adding and removing theme
$theme = PageTheme::add('custom_theme');
$theme = PageTheme::getByHandle('custom_theme');
$theme->uninstall();
Single Page
Registering a Single Page
$singlePage = SinglePage::add('mypage');
Adding attributes to a Page
$singlePage->setAttribute('exclude_nav', 1);