Orchard CMS Update Common_BodyPartRecord table - orchardcms

I need to make some text changes to over 100 blog posts migrated from a Wordpress site. I was going to do this via SQL to update rows in the Common_BodyPartRecord table.
When I update the rows the changes are not reflected in the front end. I understand Orchard uses NHibernate, is there some sort of caching I am not aware of?
I know that you are advised to not mess about in the database, so is there a better way to do some bulk text manipulation? If necessary I can generate an Orchard module and do this via a database migration.
NB All blog posts are latest and published.

It's not exactly caching per se, it's that the body part is also stored on the Infoset, which is a blob of XML that you can find on the content item records. You need to change both.

Related

Using Azure Search to index and search an Orchard CMS site

I am working on an Orchard CMS system that is hosted in Azure. However, using the inbuilt Lucene search it has proved difficult to implement a search algorithm that filters out documents that are links to files (e.g. PDF/Images) and filtering out documents that do not belong to certain taxonomies have are associated in a certain lat/long square, date/time of occurrence. To get an idea of the data that I am dealing with, the website is https://ahdb.org.uk/. Consequently, I am looking into implementing Azure Search to index and provide the search functionality for the site. Just so that you know the version of Orchard that is installed is 1.10.1.0.
I have searched the web to the best of my ability and there seems to be nothing out there.
Graham Harris
While there's no direct integration of Orchard with Azure Cognitive Search, it should still be possible with a little work. It looks like you have custom rules about what you need to index. You might need to create a custom database view that normalizes the data and is specific about your use case, and then feed that into the Azure Search pipeline. The Orchard 1.x schema is very relational, and will require some understanding of how parts and content items are related, as well as how versioning is implemented. A good way to do that is to install the miniprofiler module and look at some of the queries being generated by Orchard itself as it's doing similar tasks (such as a projection of data that looks like what you want to feed into search).

Kentico CustomTableForm - Save records to a custom table

I am very new to Kentico. I have been saddled with a project of recreating a spreadsheet as part of a Kentico built website. I need to accept input from a form, and do calculations and then spit the results back on the screen for the end-user. Again...I am very new to Kentico. So I have been trying to use a custom table, and a custom-table-form. I have it saving an initial record to the custom table, but it overwrites it each time. What would be a proper way of taking in an end-users values from a form and being able to preform basic CRUD tasks with that data (and then display it back on the page for the user to see)?
Thanks in advance!
#Tom,
Please try with Custom Table Input Edit web part from Kentico Marketplace.
You can always use the rest service
you can have table url like ~/rest/customtableitem.customtable.sampletable?format=json
and then do all CRUD operations.
The other way if you are new (my suggestion) is to start with examples (install corporate site example locally if you don't have it ). Check the /Examples/Web-parts/Custom-tables/ section it has all the example how to deal with a custom table. For editing you can use combination: custom table you should use custom table repeater, object management buttons and custom table form. Install the the example (even with the trial version)

Programatically delete a user in Orchard

I am not an Orchard guru. I am a desktop apps guy with a lot of responsibilities that inherited a big blob of Orchard code and have been tasked with a few maintenance tools. I have tried googling the interwebs to no avail, so I am turning to Stack in a desperate attempt that someone has the easy button...
Basically (and this is an over-simplified use case) - we frequently have users that signup with a mistyped email address or forget their account information within a day or signup again but fat finger the password and then signup a third time, etc...
I have a maintenance console that allows an administrator to 'locate' data (in our own non-orchard sql tables) associated with the first or second accounts (in my example) and re-associate that data with the third 'current/correct' account.
At the conclusion of this re-mapping, I would like to programmatically clean-up (read: delete) the Orchard logins for the first two accounts which are now officially kruft.
I found some information on Stack here that talks about Orchard user accounts:
Users are content types and Orchard creates content items for each
user. When you create a new user Orchard adds records to
xxx_Orchard_Users_UserPartRecord,
xxx_Orchard_Framework_ContentItemRecord,
xxx_Orchard_Framework_ContentItemVersionRecord and
xxx_Orchard_Roles_UserRolesPartRecord if you linked any roles to the
user.
The xxx_Orchard_Framework_ContentItemVersionRecord table keeps track
of the version number and whether or not a content item is published
or not and which version of the published content item is the latest.
When you delete the user Orchard does not delete the records from the
tables, but simply creates a new version record and sets Published and
Latest columns to 0 for the new version and the old version. Because
there is no published and latest version the content item does not
show up on the list of users.
I understand this conceptually, but I can't believe to delete a user that I would be required to delete the records from each of these 'private' tables in orchard. Instead, I expect there is a class/method/technique for deleting the Content Type or Part or Record or whatever (I'm still haven't quite got Orchard object naming straight in my head).
Can anyone share an example of deleting a user in code (by Id or Username or Email)? Or point me at the relevant documentation? I'm fumbling around like a fish outta water here...
As always, thanks in advance!
So as you say, within Orchard most deletes from the UI are soft deletes, keeping all the data and setting a flag in the database to say this guy is deleted. To do this programmatically, where _contentManager is an instance of IContentManager.
var userItem = _contentManager.Get<IUser>(userId);
_contentManager.Remove(userItem);
To do a hard delete, which will delete the item record, all item version records and all content part records (titlepart, userpart etc.)
var userItem = _contentManager.Get<IUser>(userId);
_contentManager.Destroy(userItem);
This was added to orchard in version 1.9.

How to send data to Databse in CMS Made Simple

I am quite new to CMS MAde Simple. I am not able to understand how the
data can be saved to database. I think its in smarty framework.
Storing form data in your database is actually a built-in feature of the FormBuilder module.
To do this add a new field to your form, and choose "*Store Results In Database" as the type of field. Data will be stored in an XML format in the [PREFIX]_module_fb_formbrowser database table.
It uses ADOdb as an "interface" to the database. Basically developers of CMSMS already wrote SQL statements for update and delete content. I am really sorry but this is a very wide topic. The actual purpose of a CMS is to remove the burden from the user to actually know these kinds of stuff. I suggest you first do some reading on PHP, SQL and then come back with a more specific question.
SQL
PHP
CMS Made Simple Documentation

How can I programmatically determine the creator of a Domino database?

I'm using the built-in Domain Catalog database to list all the databases on a particular Domino server. I'm creating a custom view to show certain information about each database. What I'd like to have is a column that displays the creator of each database. However, if the Domain Catalog is keeping track of this information, I can't find it.
Is there a field in the Domain Catalog that provides this information that I just haven't been able to find? Is there some other way I might find this information and get it into this view? #DBlookup and related functions don't work in column formulas.
That information is not stored in the catalog, and is probably not stored in the database either (It's not shown on any of the property tabs).
You would probably need to get/write a server add-in to monitor database creation and store that data somewhere. Then you'd need to account for databases created by adminp/replication - your add-in might pick them up as having been created by a server.
This question was also asked in the R4/R5 forums in 1998 and received no answer.
Interesting question. There is no such attribute for database, but you can dig for some clues.
New databases: use NotesNoteCollection and look for some specific design element (icon, for example) and look for first element in $UpdatedBy field.
New copies/from templates: above mentioned method won't work. It will return info from original/template, not current database. In this case, try using Created property of DB and check user footprints after that date - in ACL log (he probably altered ACL immediately after copy), new design elements (probably made new view, folder, agent...) or profile documents.
What Frantisek said. Looking in the log archive (ugh!) may tell you who deployed it, but in a well run environment that won't be who developed it. A list of $UpdatedBy(0) for all design notes should give you a good idea. The catch will be that it mayl be people who left the company years ago. : )

Resources