Drupal 7 Content Deadline - drupal

I am using Drupal 7 and a custom CCK content in order to allow users to submit information to our website. I'd like to be able to only allow submissions between a set of user definable dates. Once the dates expire, i'd like for the user to receive a message of some sort stating that the deadline for submissions is now expired when they click the link to open the form.
I currently manually go in and turn off permissions to the content type once the deadline expires, but that is clunky and requires a little too much management (I have 15 forms I need to do this for). I've searched stack overflow and google and have not come up with anything that fit my needs, most likely because I'm not using the right keywords.
Does anyone know an easy way to do this with a module or do I need to try to write my own in order to accomplish this goal? Thanks in advance for any help.

I think you have to write some custom module to achieve this. You would use hook_node_access() to control node creation page access and and put your error message and/or redirection.
https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_access/7
Another solution is to use Webform module.
https://www.drupal.org/project/webform
Download version 7.x-4.x
Create a form and in the settings there is an option to control total submissions limit, and set time frames for limitations.
Hope this helps.

You can achieve this by:
Create a column in user table in mysql called "expDate", assign the expDate values(mm-dd-yyyy) to each user
In drupal, on the page where users summit message, write php code to grab the expDate from database, and compare it to Current Date, date('mm-dd-yyyy'). Just copy can paste the php codes in each page where you have the form.
You can also pass the expDate from php to js, then do some fancy job instead of simple alert.

Related

How to add a membership cards to my website that can member downloaded

I have a website with Wordpress and I want to add members cards that they can fill their information and can download it from the website, but not sure how to do it I look for a plugin but I did not find.
also, I have 2 data on my website 'Event and Users' could I add them in one excel sheet or no?
I tried to look for a plugin
you need to separate your questions and add more information about your problem.
I'll try to help you:
** members cards **
You can use a form plugin to let the user fill the data (for example: name, surname, birth date, ecc..) that you need to print in the card. I suggest you to use this: https://formidableforms.com
the difficult way: you can intercept the form submission with formidable specific function "https://formidableforms.com/knowledgebase/frm_after_create_entry/" and with the collected data you can create image in the fly with php and imagemagik (or GD or other) https://www.php.net/manual/en/book.imagick.php. This part need that you have a little bit of experience in development. Check next point for a much simpler alternatives
the simple way: With formidable you can create a post (or better custom post) with the collected data without working on code:
https://formidableforms.com/knowledgebase/create-posts/ then you can redirect user to that page.
Invite the user to print that page and setup a specific css for print: https://benfrain.com/create-print-styles-using-css3-media-queries/

Has anyone displayed a Salesforce Dashboard component on WordPress site? If so, how?

I work for a nonprofit which help disabled military veterans. We have all our participants register with us using Salesforce as the repository of their registrations. We have dashboard components in Salesforce Lighting which totals up the number of active participants we have. I would like to display the component on our WordPress site but have never done anything like that before. I was hoping to find someone who has done something like that and offer some direction on how to go about doing it.
I tried looking up WordPress plugins which integrate with Salesforce. Most seem to be geared towards sending registrations back and forth but not displaying information. From a little bit of research, it seems like coding might need to be involved. Maybe doing a REST API with a Post option which will send the data through an HTTP URI? But to my understanding is that it would require WordPress to be an API. I am sure there are gaps in my logic.
I dont have an extensive amount of programing language experience but am willing to learn. I have taken a few Java and JavaScript classes in school.
I have not attempted this yet. I am just looking for feedback and direction.
Few options here, in no specific order...
Do Wordpress users have real Salesforce accounts or is their data simply stored in SF? Ask your Salesforce admin if there's a "customer community" configured (if your SF org is really old he might refer to it as customer portal). Communities offer nice way of exposing SF to poeple who don't need full SF user licenses. Think like collaborating with real SF users on "My Cases", viewing reports & dashboards... But for this you'd really need people logged in to SF so it won't work if you want just something anonymous. Some more info
Another option might be using Sites (Visualforce pages that expose SF data to guest users). Think like displaying a product catalog, FAQ, web-to-lead form or some other generic "contact us" page that's anonymous. So if you have SF developer (or admin with good copy-paste skills) you could use some Visualforce charts. They can be 100% coded (like this) or fed data from a report (like this) so it's simpler for admin to change the report filters or something without really writing code. Not sure if the simple route will work on a Site, there are some old answers that say "No", you might have to try it out. Worst case you'd need Apex code (or JavaScript) to query SF for results and display them. And display that SF Site page as <iframe> in Wordpress.
A slight twist on the Sites option - do you use Chatter (bit like Twitter inside SF)? There's way to take a snapshot of a report when a milestone has been met and post it to chatter ("congrats for hitting X participants"). And embed feeds on Visualforce pages too. Docs
What SF edition you're on (Group/Professional/Enterprise...)? If you have API access to Salesforce you could query the info yourself from Wordpress and display it using whatever charting library's easiest for you (Google Charts, Flot...). There are tons of examples how to connect to SF from PHP (or maybe you could cannibalize a WP plugin). Technically it's one POST message to log in to SF and one GET to run a query (something as simple as SELECT COUNT() FROM Contact WHERE isActive__c = true?)
That'd be more or less everything in terms of pulling data out of Salesforce. I mean if you have API access enabled you can slice & dice it how you want, extract data with raw PHP code or use some middleware but overall idea doesn't change. Write queries yourself or use "Analytics API" to access report results (so your administrator has power to change it without coding)...
So how about pushing? SF could notify you about current participants count. At scheduled intervals or even realtime. That'd be "just" raw data though, you'd have to write visualisation yourself.
Plenty of options here
workflow rules (code-free), sends XML message to specified URL so you'd need a WP page that can "capture" the result. Could be sent on creation of new record or update of existing. Won't give you totals, it'd be data related to that particular record so you'd have to build kind of +1 / -1 counter... Or if you use a report + analytic snapshot (helper object to store report results) and have workflow on that - that could be really close to what's needed.
scheduled apex job to run some queries and send the results to you. Again - you'd need a WP url that can be called from SF
if there's a CometD plugin for Wordpress you should look at Salesforce Streaming API, Platform Events or (newer and even simpler to configure) Change Data Capture. Basically you "subscribe" to a topic (a SF query) and whenever SF data changes and SF decides it'd change the results of the query - it'd push the results to you. It's almost realtime. Too much to write about them, perhaps best if you'd try to click through some trailheads - SF self-paced training courses:
https://trailhead.salesforce.com/en/content/learn/modules/api_basics/api_basics_streaming
https://trailhead.salesforce.com/en/content/learn/modules/change-data-capture
https://trailhead.salesforce.com/en/content/learn/modules/platform_events_basics

unique download link created after button link on website (not sure what language to search on internet)

I would like to learn what language the following is done in
:
user comes to site and fills out mailing list form (for example)
when user submits the form, a unique download link is generated for the file( for example: www.myDomain.com/downloads/myFile.zip)
Bonus: have that link expire after 24 hours or however long seems necessary (I actually believe that is done with PHP, which I have been playing with, but am not even a novice yet)
I am not looking for anyone to give me the answer, but maybe point me in the right direction as to where to learn. I have googled many different variations of "unique download link on button click".
My level of knowledge is XHTML/CSS, and I have played with JavaScript and PHP, but as I said, I am not even a novice. I am looking more for what language this is done in so I can work towards it.
You can do this in pretty much any server side language including PHP. How it works is the user submits the HTML form and a PHP script will process it to see if it's filled in correctly and matches all the criteria (emails are actual emails, names aren't blank etc.). Then it would use a database backend to insert the details of the form so you have it for your records.
For the download link, once you enter the form details, it would generate a token link just for that user which has a timestamp, both (Token and Timestamp) of which will be stored in your database. This link point to your PHP script which will take in the token (URL GET Variable) and check if the token is valid and if the file timestamp is less than 24 hours. If both these conditions are true, it'll serve the file to the user for download otherwise it'll show an error.
PHP and MySQL would be a good enough tool and should be fairly easy to get started with the documentation around.
Steps:
Look into how to capture form input in PHP (validations and security too)
Storing the input in a Database (MySQL for example)
Generating a token link and store in Database with timestamp and serve to user
When token link is accessed, checking if token is valid and timestamp is not more than 24 hours

Is an custom field accesible via URL/Search query etc.?

I'm going to set up a web shop that sells domain names.
Every domain is a single post, and every post contains about 10 custom fields.
My question is, are these custom fields accessible if I don't query them?
For example, you go to a single post (a domain overview in my case) and can you retrieve the values of my custom fields? Otherwise people can retrieve the code, without paying for it. Are those custom fields accessible if I don't query them, or not all of them?
Is it safe to keep the code's where you pay for in a custom field?
Thanks in advance!
You shouldn't be able to, but there's always the possibility of security holes in WP, or even something as simple as a brute force attack on the WP Admin area or your MySQL database.
I would err on the side of caution and keep any critical data in a separate system. Maybe after someone makes a purchase, you could have them log into a separate system to retrieve their activation codes.
Gumroad might be a decent end-to-end fulfillment system for you. Each of your domains would be a separate Gumroad product, and you could paste the shortlink into WordPress as a custom field. More info: https://gumroad.com/

Drupal: Two-way communication between unregistered customer and admin

I need to setup a system where customers can choose to Request a Quote for a specific holiday package, where they will enter their personal details as well as their holiday requirements (number of rooms, etc.) and will then allow them to view a page which will have a threaded conversation between them and the admin (so the admin can reply to their quote request on the website).
The problem is that most customers won't be registered when they want to request a quote, so I was thinking that the Request a Quote page could silently register the customer as a user (using their personal details) on the same page where it asks for their holiday requirements.
The other option I can think of would be to not register them and just email them a unique URL where they can view their quote request and reply to the admin.
Could you point me in the right direction on how to do either of those?
To create a new user you can use the user_save. To create a random password you can use the use the user_password function. The all that is left is to send a mail. Either create your own or use the standard one when users are created.
Check out the Inline Registration module: it allows anonymous users to create a node and register as user at the same time, using a single form.
I think the best way would be to have a content type they fill out that looks like a form, but actually creates the node that is only visible to them and the administrators, comment enabled. Probably the quickest way. Then you have security in place so people can't see other peoples quotes.
Login Toboggan combined with Content Profile might work for this.

Resources