I am developing a drupal(7.x) module where I need to give site wide contact form permissions for all programmatically.
I want this programmatically :-
I need help about this. If any one know how to do this please help me.
Thanks and regards
Gmw Raj
My problem solved by using this solution(Jaypan)
**<?php
function mymodule_menu_alter(&$menu)
{
if(isset($menu['contact']))
{
$menu['contact']['access callback'] = TRUE;
}
}
?>**
visit this link
Related
I have been trying different ways to retrieve the current list of members in a specific channel (e.g. 'networking'). But I am only get one, the actual bot user inside the channel, but nothing else.
This is the latest version of the code I am trying.
client.channels.cache.filter((c) => c.name === 'networking').forEach(channel => {
channel.fetch().then((channel) => {
console.log(channel.name);
for (let [snowflake, guildMember] of channel.members) {
console.log(`${guildMember.displayName} (${guildMember.id})`);
}
});
});
It's probably something to do with caching but I'm just not able to find the right sequence. Any help would be appreciated.
Thank you Tyler2P for the answer. You were absolutely right. Membership intents were disabled by default. I have lost so much time on this :) Thanks a million.
For everyone who gets to this question. Solution is so simple as enabling the "Server Members Intent".
Bot configuration in Discord Application page
I am building a Laravel website where people can post tasks into a database. Currently, when I post tasks via my form, every account can see the data. How can I show data for only the specific person who posted it?
My blade file
My task controller file
Thank you very much in advance.
If your user has logged in the you can retrieve their id by Auth::user()->id;
In your index() method remove $tasks = Task::all(); and add
$userId = Auth::user()->id;
$tasks = Task::where('user_id',$userId)->get();
Hope this will help
I want to use onsen ui and angularjs to develop a hybird application, but now I meet a problem, this application cannot store user's login information, so user must login everytime after they close the application.
I use $cookies, service, and $rootScope to store user's login information, but all of them can not work at android platform.
Anyone can help me to solve this problem?
On HTML5 mobile framework like Onsenui, I suggest to use localStorage.
You can take a look at these two AngularJs modules:
angular-local-storage
ngStorage
They have very well written instructions and demo codes as references.
use this plugin https://github.com/litehelpers/Cordova-sqlite-storage or something similar to create a sqlite database. Create a table with the information you want to keep (username and password). You can create a hash of the password and store it for better security (md5 or sha1).
You can also keep the timestamp of the login and keep the user logged in for a specific interval of time, so when he opens the app, check if you are inside this interval (e.g. day, week, etc.) from the last login and if yes, log him in automatically else show the login screen again.
if (window.localStorage.getItem("rememberMe") == "true") {
$scope.userEmail = window.localStorage.getItem("userName");
$scope.userPassword = window.localStorage.getItem("password");
document.getElementById("rememberMe").checked = true;
}
else {
document.getElementById("rememberMe").checked = false;
}
if (document.getElementById("rememberMe").checked == true) {
window.localStorage.setItem("rememberMe", "true");
window.localStorage.setItem("userName", $scope.userEmail);
window.localStorage.setItem("password", $scope.userPassword);
}
else if (document.getElementById("rememberMe").checked == false) {
window.localStorage.setItem("rememberMe", "false");
window.localStorage.setItem("userName", "");
window.localStorage.setItem("password", "");
}
Hi! have a look at the above code. It stores in local storage
I have Liferay 6.2 GA4...
I want to create a birthdays calendar by code, in a portlet... so I create a calendar in my portlet, with this code:
long calendarId = CounterLocalServiceUtil.increment(Calendar.class.getName());
calendar = CalendarLocalServiceUtil.createCalendar(calendarId);
calendar.setName(BIRTHDAYS_CALENDAR_NAME);
calendar.setGroupId(themeDisplay.getScopeGroupId());
calendar.setUserId(themeDisplay.getUserId());
calendar.setCreateDate(new Date());
calendar.setCompanyId(themeDisplay.getCompanyId());
calendar.setUserName(themeDisplay.getUser().getFullName());
calendar.setModifiedDate(new Date());
calendar.setCalendarResourceId(getCalendarDefault(themeDisplay.getScopeGroupId()).getCalendarResourceId());
calendar.setColor(6663561);
CalendarLocalServiceUtil.addCalendar(calendar);
this works fine, and the calendar gets created... but after that i am facing an issue...
If I try to set permissions to the calendar in the portlet (in the site), i get a blank page with an error in the log:
java.lang.IllegalArgumentException: Permissioned model is null
so my question is:
how can i create the calendar with permissions?
i want to create it with the default permissions, when you create a calendar in the site, this is what is shown, they are:
Permissions
Viewable by: Site Members
how can i do this??
thank you!!
edit
I asked this same question in the liferay forums, and didnt get an answer there... so im asking here, hopefully ill get an answer here :)
same question
you can call:
CalendarLocalServiceUtil.addCalendar(long userId, long groupId, long calendarResourceId, java.util.Map<java.util.Locale, java.lang.String> nameMap, java.util.Map<java.util.Locale, java.lang.String> descriptionMap, java.lang.String timeZoneId, int color, boolean defaultCalendar, boolean enableComments, boolean enableRatings, com.liferay.portal.service.ServiceContext serviceContext)
it will create the resource permissions.
Fabio.
I found an answer to do it, you just have to call the addModelResource method after creating the calendar..
ResourceLocalServiceUtil.addModelResources(calendar, serviceContext);
hope it helps someone!
i'm looking for an easy way to export all active directory users info into unique vcards for each. there is some info i'd like to leave out of the vcard like home phone, and emergency contact. i've looked around the web and have little luck finding anything. any help would be appreciated.
I doubt there will be a very easy way. Ultimately, you need to
enumerate all your users (or a subset therefore)
iterate over the resulting list of users
export each user's data to a VCard
For the searching & iterating part, you can use a PrincipalSearcher to do your searching:
// create your domain context
using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain))
{
// define a "query-by-example" principal - here, we search for a UserPrincipal
// this "QBE" user would give you the ability to further limit what you get back
// as results from the searcher
UserPrincipal qbeUser = new UserPrincipal(ctx);
// create your principal searcher passing in the QBE principal
PrincipalSearcher srch = new PrincipalSearcher(qbeUser);
// find all matches
foreach(var found in srch.FindAll())
{
UserPrincipal foundUser = found as UserPrincipal;
if(foundUser != null)
{
ExportToVCard(foundUser);
}
}
}
And now all that's left to do is create the ExportToVCard function :-) See e.g. this blog post with code samples and further links for help.
If you haven't already - absolutely read the MSDN article Managing Directory Security Principals in the .NET Framework 3.5 which shows nicely how to make the best use of the new features in System.DirectoryServices.AccountManagement. Or see the MSDN documentation on the System.DirectoryServices.AccountManagement namespace.
If you just want the data itself, I would take a look at Softerra's free LDAP Browser, found here.
Setup a profile for your directory server - once it's connected in the browser, you'll see the default schema for the BaseDN you've provided during the initial setup. On the server icon, right click, and hit "Export Data".
The export wizard will walk you through most of the process, but the important part is Step 3. If you want to find all users, just set your search filter to (objectClass=user), make sure your search scope is SubTree, and then then edit what attributes you want to return.
You'll have to process the results into VCards, but this is the easiest\fastest way of getting all the users and attributes that you want.